-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed error caused by combination of match_arm_blocks and control_bra…
…ce_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`.
- Loading branch information
1 parent
81fe905
commit 041f113
Showing
4 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// rustfmt-match_arm_blocks: false | ||
// rustfmt-control_brace_style: AlwaysNextLine | ||
|
||
fn foo() { | ||
match 0 { | ||
0 => { | ||
aaaaaaaaaaaaaaaaaaaaaaaa | ||
+ bbbbbbbbbbbbbbbbbbbbbbbbb | ||
+ bbbbbbbbbbbbbbbbbbbbbbbbb | ||
+ bbbbbbbbbbbbbbbbbbbbbbbbb | ||
+ bbbbbbbbbbbbbbbbbbbbbbbbb | ||
} | ||
_ => 2, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// rustfmt-match_arm_blocks: false | ||
// rustfmt-control_brace_style: AlwaysNextLine | ||
|
||
fn foo() { | ||
match 0 | ||
{ | ||
0 => | ||
aaaaaaaaaaaaaaaaaaaaaaaa | ||
+ bbbbbbbbbbbbbbbbbbbbbbbbb | ||
+ bbbbbbbbbbbbbbbbbbbbbbbbb | ||
+ bbbbbbbbbbbbbbbbbbbbbbbbb | ||
+ bbbbbbbbbbbbbbbbbbbbbbbbb, | ||
_ => 2, | ||
} | ||
} |