-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.
Description
This was originally proposed in rust-lang/rust#36361
See how in the following, all the |
bars are mostly aligned except the last one:
#![allow(dead_code)]
use E::*;
enum E {
A,
B,
C,
D,
}
fn main() {
match A {
A |
B |
C |
D => (),
}
}
I'd propose it be allowed at the beginning of the pattern as well enabling something like this:
#![allow(dead_code)]
use E::*;
enum E {
A,
B,
C,
D,
}
fn main() {
match A {
| A
| B
| C
| D => (),
}
}
This appears to be the official style for F# matches and it has grown on me a lot. It highlights the matches and doesn't require as much deeper nesting. After getting used to the F# style, the inability to do this is rust seems a bit limiting.
mcarton, Victor-Savu, oli-obk, Idyllei, wesleywiser and 2 morelilydjwg and PatchMixolydic
Metadata
Metadata
Assignees
Labels
T-langRelevant to the language team, which will review and decide on the RFC.Relevant to the language team, which will review and decide on the RFC.