Skip to content

Conversation

@A4-Tacks
Copy link
Member

Example

fn foo() {
    let None$0 = Some(5);
}

->

fn foo() {
    let None = Some(5) else { return };
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 29, 2025
Comment on lines 41 to 44
let insert_offset = let_stmt
.semicolon_token()
.map(|it| it.text_range().start())
.unwrap_or_else(|| let_stmt.syntax().text_range().end());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This offset might be within a macro expansion due to the above d.pat.value.to_node(&root) call. So we need to upmap things out of macro expansions here to accommodate for that

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay

Example
---
```rust
fn foo() {
    let None$0 = Some(5);
}
```

->

```rust
fn foo() {
    let None = Some(5) else { return };
}
```
@A4-Tacks A4-Tacks force-pushed the non-exhaustive-let-fixes branch from e837d66 to 8c29f73 Compare October 26, 2025 09:33
@A4-Tacks A4-Tacks requested a review from Veykril October 26, 2025 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants