Skip to content

Commit e366a83

Browse files
committed
Apply updated matches! formatting to rustfmt
Since rustfmt uses version two formatting the self tests were failing due to the new special case handling for `matches!`. various `matches!` calls in the codebase were updated to address this issue.
1 parent 281802a commit e366a83

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

tests/source/issue_5709.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-version: Two
1+
// rustfmt-style_edition: 2027
22

33
fn is_something(foo: Foo, bar: Bar) -> bool {
44
matches!((legacy_required_finality, signature_weight),

tests/source/macros/matches/version_two.rs renamed to tests/source/macros/matches/style_edition_2027.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//rustfmt-version: Two
1+
//rustfmt-style_edition: 2027
22

33
// To visually verify the special case handling of `matches!` we include the equivalent match expr
44

tests/target/issue_5709.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustfmt-version: Two
1+
// rustfmt-style_edition: 2027
22

33
fn is_something(foo: Foo, bar: Bar) -> bool {
44
matches!(

tests/target/macros/matches/version_two.rs renamed to tests/target/macros/matches/style_edition_2027.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//rustfmt-version: Two
1+
//rustfmt-style_edition: 2027
22

33
// To visually verify the special case handling of `matches!` we include the equivalent match expr
44

@@ -69,14 +69,7 @@ fn other_scenarios() {
6969
// short expr and pattern, but guard is long.
7070
matches!(
7171
something,
72-
Some(_)
73-
if method(
74-
very_long_input_1,
75-
very_long_input_2,
76-
very_long_input_3,
77-
very_long_input_4,
78-
very_long_input_5
79-
),
72+
Some(_) if method(very_long_input_1, very_long_input_2, very_long_input_3, very_long_input_4, very_long_input_5),
8073
);
8174
match something {
8275
Some(_)
@@ -122,8 +115,8 @@ impl Mystruct {
122115
matches!(
123116
self,
124117
OverflowableItem::Expr(..)
125-
| OverflowableItem::MacroArg(MacroArg::Expr(..))
126-
| OverflowableItem::MatchMacroItem(MatchMacroItem::Expr(..))
118+
| OverflowableItem::MacroArg(MacroArg::Expr(..))
119+
| OverflowableItem::MatchMacroItem(MatchMacroItem::Expr(..))
127120
if self.condition()
128121
);
129122

@@ -140,7 +133,9 @@ fn multi_line_struct_pattern_with_guard() {
140133
matches!(
141134
token,
142135
Token::Dimension {
143-
value, ref unit, ..
136+
value,
137+
ref unit,
138+
..
144139
} if num_context.is_ok(context.parsing_mode, value)
145140
);
146141

0 commit comments

Comments
 (0)