@@ -130,10 +130,7 @@ impl LitKind {
130
130
}
131
131
132
132
crate fn may_have_suffix ( self ) -> bool {
133
- match self {
134
- Integer | Float | Err => true ,
135
- _ => false ,
136
- }
133
+ matches ! ( self , Integer | Float | Err )
137
134
}
138
135
}
139
136
@@ -305,10 +302,7 @@ impl TokenKind {
305
302
}
306
303
307
304
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 ) )
312
306
}
313
307
}
314
308
@@ -346,18 +340,21 @@ impl Token {
346
340
}
347
341
348
342
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
+ )
354
354
}
355
355
356
356
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 ) )
361
358
}
362
359
363
360
/// Returns `true` if the token can appear at the start of an expression.
@@ -379,13 +376,10 @@ impl Token {
379
376
ModSep | // global path
380
377
Lifetime ( ..) | // labeled loop
381
378
Pound => true , // expression attributes
382
- Interpolated ( ref nt) => match * * nt {
383
- NtLiteral ( ..) |
379
+ Interpolated ( ref nt) => matches ! ( * * nt, NtLiteral ( ..) |
384
380
NtExpr ( ..) |
385
381
NtBlock ( ..) |
386
- NtPath ( ..) => true ,
387
- _ => false ,
388
- } ,
382
+ NtPath ( ..) ) ,
389
383
_ => false ,
390
384
}
391
385
}
@@ -405,10 +399,7 @@ impl Token {
405
399
Lifetime ( ..) | // lifetime bound in trait object
406
400
Lt | BinOp ( Shl ) | // associated path
407
401
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 ( ..) ) ,
412
403
_ => false ,
413
404
}
414
405
}
@@ -417,10 +408,7 @@ impl Token {
417
408
pub fn can_begin_const_arg ( & self ) -> bool {
418
409
match self . kind {
419
410
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 ( ..) ) ,
424
412
_ => self . can_begin_literal_maybe_minus ( ) ,
425
413
}
426
414
}
@@ -436,10 +424,7 @@ impl Token {
436
424
437
425
/// Returns `true` if the token is any literal.
438
426
pub fn is_lit ( & self ) -> bool {
439
- match self . kind {
440
- Literal ( ..) => true ,
441
- _ => false ,
442
- }
427
+ matches ! ( self . kind, Literal ( ..) )
443
428
}
444
429
445
430
/// Returns `true` if the token is any literal, a minus (which can prefix a literal,
0 commit comments