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 @@ -7455,13 +7455,12 @@ impl<'a> Parser<'a> {
7455
7455
} else if self . look_ahead ( 1 , |t| * t == token:: OpenDelim ( token:: Paren ) ) {
7456
7456
let ident = self . parse_ident ( ) . unwrap ( ) ;
7457
7457
self . bump ( ) ; // `(`
7458
- let kw_name = match self . parse_self_arg_with_attrs ( ) {
7459
- Ok ( Some ( _) ) => "method" ,
7460
- Ok ( None ) => "function" ,
7461
- Err ( mut err) => {
7462
- err. cancel ( ) ;
7463
- "function"
7464
- }
7458
+ let kw_name = if let Ok ( Some ( _) ) = self . parse_self_arg_with_attrs ( )
7459
+ . map_err ( |mut e| e. cancel ( ) )
7460
+ {
7461
+ "method"
7462
+ } else {
7463
+ "function"
7465
7464
} ;
7466
7465
self . consume_block ( token:: Paren ) ;
7467
7466
let ( kw, kw_name, ambiguous) = if self . check ( & token:: RArrow ) {
@@ -7509,7 +7508,9 @@ impl<'a> Parser<'a> {
7509
7508
self . eat_to_tokens ( & [ & token:: Gt ] ) ;
7510
7509
self . bump ( ) ; // `>`
7511
7510
let ( kw, kw_name, ambiguous) = if self . eat ( & token:: OpenDelim ( token:: Paren ) ) {
7512
- if let Ok ( Some ( _) ) = self . parse_self_arg_with_attrs ( ) {
7511
+ if let Ok ( Some ( _) ) = self . parse_self_arg_with_attrs ( )
7512
+ . map_err ( |mut e| e. cancel ( ) )
7513
+ {
7513
7514
( "fn" , "method" , false )
7514
7515
} else {
7515
7516
( "fn" , "function" , false )
You can’t perform that action at this time.
0 commit comments