@@ -130,10 +130,7 @@ impl LitKind {
130130 }
131131
132132 crate fn may_have_suffix ( self ) -> bool {
133- match self {
134- Integer | Float | Err => true ,
135- _ => false ,
136- }
133+ matches ! ( self , Integer | Float | Err )
137134 }
138135}
139136
@@ -305,10 +302,7 @@ impl TokenKind {
305302 }
306303
307304 pub fn should_end_const_arg ( & self ) -> bool {
308- match self {
309- Gt | Ge | BinOp ( Shr ) | BinOpEq ( Shr ) => true ,
310- _ => false ,
311- }
305+ matches ! ( self , Gt | Ge | BinOp ( Shr ) | BinOpEq ( Shr ) )
312306 }
313307}
314308
@@ -346,18 +340,21 @@ impl Token {
346340 }
347341
348342 pub fn is_op ( & self ) -> bool {
349- match self . kind {
350- OpenDelim ( ..) | CloseDelim ( ..) | Literal ( ..) | DocComment ( ..) | Ident ( ..)
351- | Lifetime ( ..) | Interpolated ( ..) | Eof => false ,
352- _ => true ,
353- }
343+ !matches ! (
344+ self . kind,
345+ OpenDelim ( ..)
346+ | CloseDelim ( ..)
347+ | Literal ( ..)
348+ | DocComment ( ..)
349+ | Ident ( ..)
350+ | Lifetime ( ..)
351+ | Interpolated ( ..)
352+ | Eof
353+ )
354354 }
355355
356356 pub fn is_like_plus ( & self ) -> bool {
357- match self . kind {
358- BinOp ( Plus ) | BinOpEq ( Plus ) => true ,
359- _ => false ,
360- }
357+ matches ! ( self . kind, BinOp ( Plus ) | BinOpEq ( Plus ) )
361358 }
362359
363360 /// Returns `true` if the token can appear at the start of an expression.
@@ -379,13 +376,10 @@ impl Token {
379376 ModSep | // global path
380377 Lifetime ( ..) | // labeled loop
381378 Pound => true , // expression attributes
382- Interpolated ( ref nt) => match * * nt {
383- NtLiteral ( ..) |
379+ Interpolated ( ref nt) => matches ! ( * * nt, NtLiteral ( ..) |
384380 NtExpr ( ..) |
385381 NtBlock ( ..) |
386- NtPath ( ..) => true ,
387- _ => false ,
388- } ,
382+ NtPath ( ..) ) ,
389383 _ => false ,
390384 }
391385 }
@@ -405,10 +399,7 @@ impl Token {
405399 Lifetime ( ..) | // lifetime bound in trait object
406400 Lt | BinOp ( Shl ) | // associated path
407401 ModSep => true , // global path
408- Interpolated ( ref nt) => match * * nt {
409- NtTy ( ..) | NtPath ( ..) => true ,
410- _ => false ,
411- } ,
402+ Interpolated ( ref nt) => matches ! ( * * nt, NtTy ( ..) | NtPath ( ..) ) ,
412403 _ => false ,
413404 }
414405 }
@@ -417,10 +408,7 @@ impl Token {
417408 pub fn can_begin_const_arg ( & self ) -> bool {
418409 match self . kind {
419410 OpenDelim ( Brace ) => true ,
420- Interpolated ( ref nt) => match * * nt {
421- NtExpr ( ..) | NtBlock ( ..) | NtLiteral ( ..) => true ,
422- _ => false ,
423- } ,
411+ Interpolated ( ref nt) => matches ! ( * * nt, NtExpr ( ..) | NtBlock ( ..) | NtLiteral ( ..) ) ,
424412 _ => self . can_begin_literal_maybe_minus ( ) ,
425413 }
426414 }
@@ -436,10 +424,7 @@ impl Token {
436424
437425 /// Returns `true` if the token is any literal.
438426 pub fn is_lit ( & self ) -> bool {
439- match self . kind {
440- Literal ( ..) => true ,
441- _ => false ,
442- }
427+ matches ! ( self . kind, Literal ( ..) )
443428 }
444429
445430 /// Returns `true` if the token is any literal, a minus (which can prefix a literal,
0 commit comments