Skip to content

feat: offer on match kw to merge all match arms#22716

Open
A4-Tacks wants to merge 1 commit into
rust-lang:masterfrom
A4-Tacks:merge-all-arms
Open

feat: offer on match kw to merge all match arms#22716
A4-Tacks wants to merge 1 commit into
rust-lang:masterfrom
A4-Tacks:merge-all-arms

Conversation

@A4-Tacks

@A4-Tacks A4-Tacks commented Jul 3, 2026

Copy link
Copy Markdown
Member

Close #20323

Example

fn main() {
    let y = $0match X::A {
        X::A => 1i32,
        X::B => 1i32,
        X::C => 2i32,
        X::D => 3i32,
        X::E => 3i32,
    }
}

Before this PR

Assist not applicable

After this PR

fn main() {
    let y = match X::A {
        X::A | X::B => 1i32,
        X::C => 2i32,
        X::D | X::E => 3i32,
    }
}
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 3, 2026
@rustbot

rustbot commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Example
---
```rust
fn main() {
    let y = $0match X::A {
        X::A => 1i32,
        X::B => 1i32,
        X::C => 2i32,
        X::D => 3i32,
        X::E => 3i32,
    }
}
```

**Before this PR**

Assist not applicable

**After this PR**

```rust
fn main() {
    let y = match X::A {
        X::A | X::B => 1i32,
        X::C => 2i32,
        X::D | X::E => 3i32,
    }
}
```
@ChayimFriedman2

Copy link
Copy Markdown
Contributor

I remain in the opinion that this is not worth it, even without a new assist.

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.

3 participants