Skip to content

fix: don't produce redundant block in move_guard#21485

Merged
ShoyuVanilla merged 1 commit intorust-lang:masterfrom
A4-Tacks:move-guard-clean-block
Jan 20, 2026
Merged

fix: don't produce redundant block in move_guard#21485
ShoyuVanilla merged 1 commit intorust-lang:masterfrom
A4-Tacks:move-guard-clean-block

Conversation

@A4-Tacks
Copy link
Member

Example

fn main() {
    match 92 {
        x $0if x > 10 => {
            let _ = true;
            false
        },
        _ => true
    }
}

Before this PR

fn main() {
    match 92 {
        x => if x > 10 {
            {
                let _ = true;
                false
            }
        },
        _ => true
    }
}

After this PR

fn main() {
    match 92 {
        x => if x > 10 {
            let _ = true;
            false
        },
        _ => true
    }
}

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 17, 2026
Example
---
```rust
fn main() {
    match 92 {
        x $0if x > 10 => {
            let _ = true;
            false
        },
        _ => true
    }
}
```

**Before this PR**

```rust
fn main() {
    match 92 {
        x => if x > 10 {
            {
                let _ = true;
                false
            }
        },
        _ => true
    }
}
```

**After this PR**

```rust
fn main() {
    match 92 {
        x => if x > 10 {
            let _ = true;
            false
        },
        _ => true
    }
}
```
@A4-Tacks A4-Tacks force-pushed the move-guard-clean-block branch from 16a78d1 to 4db75a1 Compare January 17, 2026 12:26
@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Jan 20, 2026
Merged via the queue into rust-lang:master with commit b5eb57a Jan 20, 2026
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 20, 2026
@lnicola lnicola changed the title Improve move_guard redundanted block fix: don't produce redundant block in move_guard Jan 20, 2026
@A4-Tacks A4-Tacks deleted the move-guard-clean-block branch January 22, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants