File tree Expand file tree Collapse file tree 2 files changed +12
-20
lines changed Expand file tree Collapse file tree 2 files changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -118,10 +118,7 @@ pub(crate) fn expand_test_or_bench(
118
118
119
119
let ( item, is_stmt) = match item {
120
120
Annotatable :: Item ( i) => ( i, false ) ,
121
- Annotatable :: Stmt ( stmt) if matches ! ( stmt. kind, ast:: StmtKind :: Item ( _) ) => {
122
- // FIXME: Use an 'if let' guard once they are implemented
123
- if let ast:: StmtKind :: Item ( i) = stmt. kind { ( i, true ) } else { unreachable ! ( ) }
124
- }
121
+ Annotatable :: Stmt ( stmt) if let ast:: StmtKind :: Item ( _) = stmt. kind => ( i, true ) ,
125
122
other => {
126
123
not_testable_error ( cx, attr_sp, None ) ;
127
124
return vec ! [ other] ;
Original file line number Diff line number Diff line change @@ -2273,23 +2273,18 @@ impl<'a> Parser<'a> {
2273
2273
) ,
2274
2274
// Also catches `fn foo(&a)`.
2275
2275
PatKind :: Ref ( ref inner_pat, mutab)
2276
- if matches ! ( inner_pat . clone ( ) . kind , PatKind :: Ident ( .. ) ) =>
2276
+ if let PatKind :: Ident ( _ , ident , _ ) = inner_pat . clone ( ) . kind =>
2277
2277
{
2278
- match inner_pat. clone ( ) . kind {
2279
- PatKind :: Ident ( _, ident, _) => {
2280
- let mutab = mutab. prefix_str ( ) ;
2281
- (
2282
- ident,
2283
- "self: " ,
2284
- format ! ( "{ident}: &{mutab}TypeName" ) ,
2285
- "_: " ,
2286
- pat. span . shrink_to_lo ( ) ,
2287
- pat. span ,
2288
- pat. span . shrink_to_lo ( ) ,
2289
- )
2290
- }
2291
- _ => unreachable ! ( ) ,
2292
- }
2278
+ let mutab = mutab. prefix_str ( ) ;
2279
+ (
2280
+ ident,
2281
+ "self: " ,
2282
+ format ! ( "{ident}: &{mutab}TypeName" ) ,
2283
+ "_: " ,
2284
+ pat. span . shrink_to_lo ( ) ,
2285
+ pat. span ,
2286
+ pat. span . shrink_to_lo ( ) ,
2287
+ )
2293
2288
}
2294
2289
_ => {
2295
2290
// Otherwise, try to get a type and emit a suggestion.
You can’t perform that action at this time.
0 commit comments