rust/tests/source/issue_5912.rs
GambitingMan 041f113159
Fixed error caused by combination of match_arm_blocks and control_brace_style
Fixes 5912

When `control_brace_style = "AlwaysNextLine"`, the code seems to always assume that `body_prefix` is `{`. This is however not the case when `match_arm_blocks = false`. This causes `block_sep` to introduce extra white space that causes the error.

The fix was to check if `body_prefix` is empty before matching on `ControlBraceStyle::AlwaysNextLine`.
2023-10-23 20:27:26 -04:00

16 lines
370 B
Rust

// rustfmt-match_arm_blocks: false
// rustfmt-control_brace_style: AlwaysNextLine
fn foo() {
match 0 {
0 => {
aaaaaaaaaaaaaaaaaaaaaaaa
+ bbbbbbbbbbbbbbbbbbbbbbbbb
+ bbbbbbbbbbbbbbbbbbbbbbbbb
+ bbbbbbbbbbbbbbbbbbbbbbbbb
+ bbbbbbbbbbbbbbbbbbbbbbbbb
}
_ => 2,
}
}