mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-13 00:56:14 +00:00
abca1deded
Makes it optional whether to indent arms in match expressions. Setting this to false may be desirable for people wishing to avoid double-indents, in that if the match arm is a block, the block will cause an extra indentation level, and if it isn't a block but just a single line, it's still easy to see the logic at a glance. This style is preferred in certain other languages with switch statements, e.g. Linux style C and the most common Java style.
28 lines
473 B
Rust
28 lines
473 B
Rust
// rustfmt-indent_match_arms: false
|
|
|
|
fn main() {
|
|
match x {
|
|
1 => "one",
|
|
2 => "two",
|
|
3 => "three",
|
|
4 => "four",
|
|
5 => "five",
|
|
_ => "something else",
|
|
}
|
|
|
|
match x {
|
|
1 => "one",
|
|
2 => "two",
|
|
3 => "three",
|
|
4 => "four",
|
|
5 => match y {
|
|
'a' => 'A',
|
|
'b' => 'B',
|
|
'c' => 'C',
|
|
_ => "Nope",
|
|
},
|
|
_ => "something else",
|
|
}
|
|
|
|
}
|