File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -7410,13 +7410,12 @@ impl<'a> Parser<'a> {
7410
7410
} else if self . look_ahead ( 1 , |t| * t == token:: OpenDelim ( token:: Paren ) ) {
7411
7411
let ident = self . parse_ident ( ) . unwrap ( ) ;
7412
7412
self . bump ( ) ; // `(`
7413
- let kw_name = match self . parse_self_arg_with_attrs ( ) {
7414
- Ok ( Some ( _) ) => "method" ,
7415
- Ok ( None ) => "function" ,
7416
- Err ( mut err) => {
7417
- err. cancel ( ) ;
7418
- "function"
7419
- }
7413
+ let kw_name = if let Ok ( Some ( _) ) = self . parse_self_arg_with_attrs ( )
7414
+ . map_err ( |mut e| e. cancel ( ) )
7415
+ {
7416
+ "method"
7417
+ } else {
7418
+ "function"
7420
7419
} ;
7421
7420
self . consume_block ( token:: Paren ) ;
7422
7421
let ( kw, kw_name, ambiguous) = if self . check ( & token:: RArrow ) {
@@ -7464,7 +7463,9 @@ impl<'a> Parser<'a> {
7464
7463
self . eat_to_tokens ( & [ & token:: Gt ] ) ;
7465
7464
self . bump ( ) ; // `>`
7466
7465
let ( kw, kw_name, ambiguous) = if self . eat ( & token:: OpenDelim ( token:: Paren ) ) {
7467
- if let Ok ( Some ( _) ) = self . parse_self_arg_with_attrs ( ) {
7466
+ if let Ok ( Some ( _) ) = self . parse_self_arg_with_attrs ( )
7467
+ . map_err ( |mut e| e. cancel ( ) )
7468
+ {
7468
7469
( "fn" , "method" , false )
7469
7470
} else {
7470
7471
( "fn" , "function" , false )
You can’t perform that action at this time.
0 commit comments