Skip to content

Commit 0c5552d

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 93130c0 commit 0c5552d

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

src/expr.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1891,9 +1891,9 @@ impl<'ast> RhsAssignKind<'ast> {
18911891
matches!(
18921892
kind,
18931893
ast::ExprKind::Try(..)
1894-
| ast::ExprKind::Field(..)
1895-
| ast::ExprKind::MethodCall(..)
1896-
| ast::ExprKind::Await(_)
1894+
| ast::ExprKind::Field(..)
1895+
| ast::ExprKind::MethodCall(..)
1896+
| ast::ExprKind::Await(_)
18971897
)
18981898
}
18991899
_ => false,

src/items.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3324,10 +3324,7 @@ pub(crate) fn rewrite_extern_crate(
33243324

33253325
/// Returns `true` for `mod foo;`, false for `mod foo { .. }`.
33263326
pub(crate) fn is_mod_decl(item: &ast::Item) -> bool {
3327-
!matches!(
3328-
item.kind,
3329-
ast::ItemKind::Mod(_, ast::ModKind::Loaded(_, ast::Inline::Yes, _))
3330-
)
3327+
!matches!(item.kind, ast::ItemKind::Mod(_, ast::ModKind::Loaded(_, ast::Inline::Yes, _)))
33313328
}
33323329

33333330
pub(crate) fn is_use_item(item: &ast::Item) -> bool {

src/macros.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -591,15 +591,12 @@ impl MacroArgKind {
591591
matches!(
592592
*self,
593593
MacroArgKind::Repeat(Delimiter::Brace, _, _, _)
594-
| MacroArgKind::Delimited(Delimiter::Brace, _)
594+
| MacroArgKind::Delimited(Delimiter::Brace, _)
595595
)
596596
}
597597

598598
fn starts_with_dollar(&self) -> bool {
599-
matches!(
600-
*self,
601-
MacroArgKind::Repeat(..) | MacroArgKind::MetaVariable(..)
602-
)
599+
matches!(*self, MacroArgKind::Repeat(..) | MacroArgKind::MetaVariable(..))
603600
}
604601

605602
fn ends_with_space(&self) -> bool {
@@ -1052,10 +1049,7 @@ fn force_space_before(tok: &TokenKind) -> bool {
10521049
}
10531050

10541051
fn ident_like(tok: &Token) -> bool {
1055-
matches!(
1056-
tok.kind,
1057-
TokenKind::Ident(..) | TokenKind::Literal(..) | TokenKind::Lifetime(_)
1058-
)
1052+
matches!(tok.kind, TokenKind::Ident(..) | TokenKind::Literal(..) | TokenKind::Lifetime(_))
10591053
}
10601054

10611055
fn next_space(tok: &TokenKind) -> SpaceState {

src/overflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ impl<'a> OverflowableItem<'a> {
141141
matches!(
142142
self,
143143
OverflowableItem::Expr(..)
144-
| OverflowableItem::MacroArg(MacroArg::Expr(..))
145-
| OverflowableItem::MatchesMacroItem(MatchesMacroItem::Expr(..))
144+
| OverflowableItem::MacroArg(MacroArg::Expr(..))
145+
| OverflowableItem::MatchesMacroItem(MatchesMacroItem::Expr(..))
146146
)
147147
}
148148

0 commit comments

Comments
 (0)