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(
118118
119119 let ( item, is_stmt) = match item {
120120 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 ( i) = stmt. kind => ( i, true ) ,
125122 other => {
126123 not_testable_error ( cx, attr_sp, None ) ;
127124 return vec ! [ other] ;
Original file line number Diff line number Diff line change @@ -2273,23 +2273,18 @@ impl<'a> Parser<'a> {
22732273 ) ,
22742274 // Also catches `fn foo(&a)`.
22752275 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 =>
22772277 {
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+ )
22932288 }
22942289 _ => {
22952290 // Otherwise, try to get a type and emit a suggestion.
You can’t perform that action at this time.
0 commit comments