rust/tests/source/indent_match_arms.rs
C4K3 abca1deded Add indent_match_arms option (#1404)
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.
2017-03-26 18:32:29 +13:00

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",
}
}