@@ -1877,7 +1877,7 @@ impl<'a> Parser<'a> {
18771877        Ok ( MutTy  {  ty :  t,  mutbl :  mutbl } ) 
18781878    } 
18791879
1880-     fn  is_named_argument ( & mut   self )  -> bool  { 
1880+     fn  is_named_argument ( & self )  -> bool  { 
18811881        let  offset = match  self . token  { 
18821882            token:: Interpolated ( ref  nt)  => match  * * nt { 
18831883                token:: NtPat ( ..)  => return  self . look_ahead ( 1 ,  |t| t == & token:: Colon ) , 
@@ -2469,27 +2469,27 @@ impl<'a> Parser<'a> {
24692469        } ) 
24702470    } 
24712471
2472-     fn  mk_expr ( & mut   self ,  span :  Span ,  node :  ExprKind ,  attrs :  ThinVec < Attribute > )  -> P < Expr >  { 
2472+     fn  mk_expr ( & self ,  span :  Span ,  node :  ExprKind ,  attrs :  ThinVec < Attribute > )  -> P < Expr >  { 
24732473        P ( Expr  {  node,  span,  attrs,  id :  ast:: DUMMY_NODE_ID  } ) 
24742474    } 
24752475
2476-     fn  mk_unary ( & mut   self ,  unop :  ast:: UnOp ,  expr :  P < Expr > )  -> ast:: ExprKind  { 
2476+     fn  mk_unary ( & self ,  unop :  ast:: UnOp ,  expr :  P < Expr > )  -> ast:: ExprKind  { 
24772477        ExprKind :: Unary ( unop,  expr) 
24782478    } 
24792479
2480-     fn  mk_binary ( & mut   self ,  binop :  ast:: BinOp ,  lhs :  P < Expr > ,  rhs :  P < Expr > )  -> ast:: ExprKind  { 
2480+     fn  mk_binary ( & self ,  binop :  ast:: BinOp ,  lhs :  P < Expr > ,  rhs :  P < Expr > )  -> ast:: ExprKind  { 
24812481        ExprKind :: Binary ( binop,  lhs,  rhs) 
24822482    } 
24832483
2484-     fn  mk_call ( & mut   self ,  f :  P < Expr > ,  args :  Vec < P < Expr > > )  -> ast:: ExprKind  { 
2484+     fn  mk_call ( & self ,  f :  P < Expr > ,  args :  Vec < P < Expr > > )  -> ast:: ExprKind  { 
24852485        ExprKind :: Call ( f,  args) 
24862486    } 
24872487
2488-     fn  mk_index ( & mut   self ,  expr :  P < Expr > ,  idx :  P < Expr > )  -> ast:: ExprKind  { 
2488+     fn  mk_index ( & self ,  expr :  P < Expr > ,  idx :  P < Expr > )  -> ast:: ExprKind  { 
24892489        ExprKind :: Index ( expr,  idx) 
24902490    } 
24912491
2492-     fn  mk_range ( & mut   self , 
2492+     fn  mk_range ( & self , 
24932493                    start :  Option < P < Expr > > , 
24942494                    end :  Option < P < Expr > > , 
24952495                    limits :  RangeLimits ) 
@@ -2501,7 +2501,7 @@ impl<'a> Parser<'a> {
25012501        } 
25022502    } 
25032503
2504-     fn  mk_assign_op ( & mut   self ,  binop :  ast:: BinOp , 
2504+     fn  mk_assign_op ( & self ,  binop :  ast:: BinOp , 
25052505                        lhs :  P < Expr > ,  rhs :  P < Expr > )  -> ast:: ExprKind  { 
25062506        ExprKind :: AssignOp ( binop,  lhs,  rhs) 
25072507    } 
@@ -2641,13 +2641,12 @@ impl<'a> Parser<'a> {
26412641                    hi = path. span ; 
26422642                    return  Ok ( self . mk_expr ( lo. to ( hi) ,  ExprKind :: Path ( Some ( qself) ,  path) ,  attrs) ) ; 
26432643                } 
2644-                 if  self . span . rust_2018 ( )  && self . check_keyword ( keywords:: Async ) 
2645-                 { 
2646-                     if  self . is_async_block ( )  {  // check for `async {` and `async move {` 
2647-                         return  self . parse_async_block ( attrs) ; 
2644+                 if  self . span . rust_2018 ( )  && self . check_keyword ( keywords:: Async )  { 
2645+                     return  if  self . is_async_block ( )  {  // check for `async {` and `async move {` 
2646+                         self . parse_async_block ( attrs) 
26482647                    }  else  { 
2649-                         return   self . parse_lambda_expr ( attrs) ; 
2650-                     } 
2648+                         self . parse_lambda_expr ( attrs) 
2649+                     } ; 
26512650                } 
26522651                if  self . check_keyword ( keywords:: Move )  || self . check_keyword ( keywords:: Static )  { 
26532652                    return  self . parse_lambda_expr ( attrs) ; 
@@ -3572,7 +3571,8 @@ impl<'a> Parser<'a> {
35723571            }  else  { 
35733572                self . restrictions 
35743573            } ; 
3575-             if  op. precedence ( )  < min_prec { 
3574+             let  prec = op. precedence ( ) ; 
3575+             if  prec < min_prec { 
35763576                break ; 
35773577            } 
35783578            // Check for deprecated `...` syntax 
@@ -3613,8 +3613,7 @@ impl<'a> Parser<'a> {
36133613                // We have 2 alternatives here: `x..y`/`x..=y` and `x..`/`x..=` The other 
36143614                // two variants are handled with `parse_prefix_range_expr` call above. 
36153615                let  rhs = if  self . is_at_start_of_range_notation_rhs ( )  { 
3616-                     Some ( self . parse_assoc_expr_with ( op. precedence ( )  + 1 , 
3617-                                                     LhsExpr :: NotYetParsed ) ?) 
3616+                     Some ( self . parse_assoc_expr_with ( prec + 1 ,  LhsExpr :: NotYetParsed ) ?) 
36183617                }  else  { 
36193618                    None 
36203619                } ; 
@@ -3634,28 +3633,18 @@ impl<'a> Parser<'a> {
36343633                break 
36353634            } 
36363635
3637-             let  rhs = match  op. fixity ( )  { 
3638-                 Fixity :: Right  => self . with_res ( 
3639-                     restrictions - Restrictions :: STMT_EXPR , 
3640-                     |this| { 
3641-                         this. parse_assoc_expr_with ( op. precedence ( ) , 
3642-                             LhsExpr :: NotYetParsed ) 
3643-                 } ) , 
3644-                 Fixity :: Left  => self . with_res ( 
3645-                     restrictions - Restrictions :: STMT_EXPR , 
3646-                     |this| { 
3647-                         this. parse_assoc_expr_with ( op. precedence ( )  + 1 , 
3648-                             LhsExpr :: NotYetParsed ) 
3649-                 } ) , 
3636+             let  fixity = op. fixity ( ) ; 
3637+             let  prec_adjustment = match  fixity { 
3638+                 Fixity :: Right  => 0 , 
3639+                 Fixity :: Left  => 1 , 
36503640                // We currently have no non-associative operators that are not handled above by 
36513641                // the special cases. The code is here only for future convenience. 
3652-                 Fixity :: None  => self . with_res ( 
3653-                     restrictions - Restrictions :: STMT_EXPR , 
3654-                     |this| { 
3655-                         this. parse_assoc_expr_with ( op. precedence ( )  + 1 , 
3656-                             LhsExpr :: NotYetParsed ) 
3657-                 } ) , 
3658-             } ?; 
3642+                 Fixity :: None  => 1 , 
3643+             } ; 
3644+             let  rhs = self . with_res ( 
3645+                 restrictions - Restrictions :: STMT_EXPR , 
3646+                 |this| this. parse_assoc_expr_with ( prec + prec_adjustment,  LhsExpr :: NotYetParsed ) 
3647+             ) ?; 
36593648
36603649            // Make sure that the span of the parent node is larger than the span of lhs and rhs, 
36613650            // including the attributes. 
@@ -3701,7 +3690,7 @@ impl<'a> Parser<'a> {
37013690                } 
37023691            } ; 
37033692
3704-             if  op . fixity ( )  ==  Fixity :: None  {  break  } 
3693+             if  let   Fixity :: None  = fixity  {  break  } 
37053694        } 
37063695        Ok ( lhs) 
37073696    } 
@@ -3838,7 +3827,7 @@ impl<'a> Parser<'a> {
38383827    /// Produce an error if comparison operators are chained (RFC #558). 
38393828     /// We only need to check lhs, not rhs, because all comparison ops 
38403829     /// have same precedence and are left-associative 
3841-      fn  check_no_chained_comparison ( & mut   self ,  lhs :  & Expr ,  outer_op :  & AssocOp )  { 
3830+      fn  check_no_chained_comparison ( & self ,  lhs :  & Expr ,  outer_op :  & AssocOp )  { 
38423831        debug_assert ! ( outer_op. is_comparison( ) , 
38433832                      "check_no_chained_comparison: {:?} is not comparison" , 
38443833                      outer_op) ; 
@@ -5133,7 +5122,7 @@ impl<'a> Parser<'a> {
51335122        } ) 
51345123    } 
51355124
5136-     fn  is_async_block ( & mut   self )  -> bool  { 
5125+     fn  is_async_block ( & self )  -> bool  { 
51375126        self . token . is_keyword ( keywords:: Async )  &&
51385127        ( 
51395128            (  // `async move {` 
@@ -5145,19 +5134,19 @@ impl<'a> Parser<'a> {
51455134        ) 
51465135    } 
51475136
5148-     fn  is_async_fn ( & mut   self )  -> bool  { 
5137+     fn  is_async_fn ( & self )  -> bool  { 
51495138        self . token . is_keyword ( keywords:: Async )  &&
51505139            self . look_ahead ( 1 ,  |t| t. is_keyword ( keywords:: Fn ) ) 
51515140    } 
51525141
5153-     fn  is_do_catch_block ( & mut   self )  -> bool  { 
5142+     fn  is_do_catch_block ( & self )  -> bool  { 
51545143        self . token . is_keyword ( keywords:: Do )  &&
51555144        self . look_ahead ( 1 ,  |t| t. is_keyword ( keywords:: Catch ) )  &&
51565145        self . look_ahead ( 2 ,  |t| * t == token:: OpenDelim ( token:: Brace ) )  &&
51575146        !self . restrictions . contains ( Restrictions :: NO_STRUCT_LITERAL ) 
51585147    } 
51595148
5160-     fn  is_try_block ( & mut   self )  -> bool  { 
5149+     fn  is_try_block ( & self )  -> bool  { 
51615150        self . token . is_keyword ( keywords:: Try )  &&
51625151        self . look_ahead ( 1 ,  |t| * t == token:: OpenDelim ( token:: Brace ) )  &&
51635152        self . span . rust_2018 ( )  &&
@@ -5179,7 +5168,7 @@ impl<'a> Parser<'a> {
51795168        self . look_ahead ( 1 ,  |t| t. is_keyword ( keywords:: Type ) ) 
51805169    } 
51815170
5182-     fn  is_auto_trait_item ( & mut   self )  -> bool  { 
5171+     fn  is_auto_trait_item ( & self )  -> bool  { 
51835172        // auto trait 
51845173        ( self . token . is_keyword ( keywords:: Auto ) 
51855174            && self . look_ahead ( 1 ,  |t| t. is_keyword ( keywords:: Trait ) ) ) 
@@ -5441,7 +5430,7 @@ impl<'a> Parser<'a> {
54415430    } 
54425431
54435432    /// Checks if this expression is a successfully parsed statement. 
5444-      fn  expr_is_complete ( & mut   self ,  e :  & Expr )  -> bool  { 
5433+      fn  expr_is_complete ( & self ,  e :  & Expr )  -> bool  { 
54455434        self . restrictions . contains ( Restrictions :: STMT_EXPR )  &&
54465435            !classify:: expr_requires_semi_to_be_stmt ( e) 
54475436    } 
@@ -6509,7 +6498,7 @@ impl<'a> Parser<'a> {
65096498        Ok ( ( id,  generics) ) 
65106499    } 
65116500
6512-     fn  mk_item ( & mut   self ,  span :  Span ,  ident :  Ident ,  node :  ItemKind ,  vis :  Visibility , 
6501+     fn  mk_item ( & self ,  span :  Span ,  ident :  Ident ,  node :  ItemKind ,  vis :  Visibility , 
65136502               attrs :  Vec < Attribute > )  -> P < Item >  { 
65146503        P ( Item  { 
65156504            ident, 
@@ -6541,7 +6530,7 @@ impl<'a> Parser<'a> {
65416530
65426531    /// Returns `true` if we are looking at `const ID` 
65436532     /// (returns `false` for things like `const fn`, etc.). 
6544-      fn  is_const_item ( & mut   self )  -> bool  { 
6533+      fn  is_const_item ( & self )  -> bool  { 
65456534        self . token . is_keyword ( keywords:: Const )  &&
65466535            !self . look_ahead ( 1 ,  |t| t. is_keyword ( keywords:: Fn ) )  &&
65476536            !self . look_ahead ( 1 ,  |t| t. is_keyword ( keywords:: Unsafe ) ) 
@@ -6649,7 +6638,7 @@ impl<'a> Parser<'a> {
66496638        } ) 
66506639    } 
66516640
6652-     fn  complain_if_pub_macro ( & mut   self ,  vis :  & VisibilityKind ,  sp :  Span )  { 
6641+     fn  complain_if_pub_macro ( & self ,  vis :  & VisibilityKind ,  sp :  Span )  { 
66536642        match  * vis { 
66546643            VisibilityKind :: Inherited  => { } 
66556644            _ => { 
@@ -6678,7 +6667,7 @@ impl<'a> Parser<'a> {
66786667        } 
66796668    } 
66806669
6681-     fn  missing_assoc_item_kind_err ( & mut   self ,  item_type :  & str ,  prev_span :  Span ) 
6670+     fn  missing_assoc_item_kind_err ( & self ,  item_type :  & str ,  prev_span :  Span ) 
66826671                                   -> DiagnosticBuilder < ' a > 
66836672    { 
66846673        let  expected_kinds = if  item_type == "extern"  { 
0 commit comments