@@ -1877,7 +1877,7 @@ impl<'a> Parser<'a> {
1877
1877
Ok ( MutTy { ty : t, mutbl : mutbl } )
1878
1878
}
1879
1879
1880
- fn is_named_argument ( & mut self ) -> bool {
1880
+ fn is_named_argument ( & self ) -> bool {
1881
1881
let offset = match self . token {
1882
1882
token:: Interpolated ( ref nt) => match * * nt {
1883
1883
token:: NtPat ( ..) => return self . look_ahead ( 1 , |t| t == & token:: Colon ) ,
@@ -2471,27 +2471,27 @@ impl<'a> Parser<'a> {
2471
2471
} )
2472
2472
}
2473
2473
2474
- fn mk_expr ( & mut self , span : Span , node : ExprKind , attrs : ThinVec < Attribute > ) -> P < Expr > {
2474
+ fn mk_expr ( & self , span : Span , node : ExprKind , attrs : ThinVec < Attribute > ) -> P < Expr > {
2475
2475
P ( Expr { node, span, attrs, id : ast:: DUMMY_NODE_ID } )
2476
2476
}
2477
2477
2478
- fn mk_unary ( & mut self , unop : ast:: UnOp , expr : P < Expr > ) -> ast:: ExprKind {
2478
+ fn mk_unary ( & self , unop : ast:: UnOp , expr : P < Expr > ) -> ast:: ExprKind {
2479
2479
ExprKind :: Unary ( unop, expr)
2480
2480
}
2481
2481
2482
- fn mk_binary ( & mut self , binop : ast:: BinOp , lhs : P < Expr > , rhs : P < Expr > ) -> ast:: ExprKind {
2482
+ fn mk_binary ( & self , binop : ast:: BinOp , lhs : P < Expr > , rhs : P < Expr > ) -> ast:: ExprKind {
2483
2483
ExprKind :: Binary ( binop, lhs, rhs)
2484
2484
}
2485
2485
2486
- fn mk_call ( & mut self , f : P < Expr > , args : Vec < P < Expr > > ) -> ast:: ExprKind {
2486
+ fn mk_call ( & self , f : P < Expr > , args : Vec < P < Expr > > ) -> ast:: ExprKind {
2487
2487
ExprKind :: Call ( f, args)
2488
2488
}
2489
2489
2490
- fn mk_index ( & mut self , expr : P < Expr > , idx : P < Expr > ) -> ast:: ExprKind {
2490
+ fn mk_index ( & self , expr : P < Expr > , idx : P < Expr > ) -> ast:: ExprKind {
2491
2491
ExprKind :: Index ( expr, idx)
2492
2492
}
2493
2493
2494
- fn mk_range ( & mut self ,
2494
+ fn mk_range ( & self ,
2495
2495
start : Option < P < Expr > > ,
2496
2496
end : Option < P < Expr > > ,
2497
2497
limits : RangeLimits )
@@ -2503,7 +2503,7 @@ impl<'a> Parser<'a> {
2503
2503
}
2504
2504
}
2505
2505
2506
- fn mk_assign_op ( & mut self , binop : ast:: BinOp ,
2506
+ fn mk_assign_op ( & self , binop : ast:: BinOp ,
2507
2507
lhs : P < Expr > , rhs : P < Expr > ) -> ast:: ExprKind {
2508
2508
ExprKind :: AssignOp ( binop, lhs, rhs)
2509
2509
}
@@ -3840,7 +3840,7 @@ impl<'a> Parser<'a> {
3840
3840
/// Produce an error if comparison operators are chained (RFC #558).
3841
3841
/// We only need to check lhs, not rhs, because all comparison ops
3842
3842
/// have same precedence and are left-associative
3843
- fn check_no_chained_comparison ( & mut self , lhs : & Expr , outer_op : & AssocOp ) {
3843
+ fn check_no_chained_comparison ( & self , lhs : & Expr , outer_op : & AssocOp ) {
3844
3844
debug_assert ! ( outer_op. is_comparison( ) ,
3845
3845
"check_no_chained_comparison: {:?} is not comparison" ,
3846
3846
outer_op) ;
@@ -5137,7 +5137,7 @@ impl<'a> Parser<'a> {
5137
5137
} )
5138
5138
}
5139
5139
5140
- fn is_async_block ( & mut self ) -> bool {
5140
+ fn is_async_block ( & self ) -> bool {
5141
5141
self . token . is_keyword ( keywords:: Async ) &&
5142
5142
(
5143
5143
( // `async move {`
@@ -5149,19 +5149,19 @@ impl<'a> Parser<'a> {
5149
5149
)
5150
5150
}
5151
5151
5152
- fn is_async_fn ( & mut self ) -> bool {
5152
+ fn is_async_fn ( & self ) -> bool {
5153
5153
self . token . is_keyword ( keywords:: Async ) &&
5154
5154
self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Fn ) )
5155
5155
}
5156
5156
5157
- fn is_do_catch_block ( & mut self ) -> bool {
5157
+ fn is_do_catch_block ( & self ) -> bool {
5158
5158
self . token . is_keyword ( keywords:: Do ) &&
5159
5159
self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Catch ) ) &&
5160
5160
self . look_ahead ( 2 , |t| * t == token:: OpenDelim ( token:: Brace ) ) &&
5161
5161
!self . restrictions . contains ( Restrictions :: NO_STRUCT_LITERAL )
5162
5162
}
5163
5163
5164
- fn is_try_block ( & mut self ) -> bool {
5164
+ fn is_try_block ( & self ) -> bool {
5165
5165
self . token . is_keyword ( keywords:: Try ) &&
5166
5166
self . look_ahead ( 1 , |t| * t == token:: OpenDelim ( token:: Brace ) ) &&
5167
5167
self . span . rust_2018 ( ) &&
@@ -5183,7 +5183,7 @@ impl<'a> Parser<'a> {
5183
5183
self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Type ) )
5184
5184
}
5185
5185
5186
- fn is_auto_trait_item ( & mut self ) -> bool {
5186
+ fn is_auto_trait_item ( & self ) -> bool {
5187
5187
// auto trait
5188
5188
( self . token . is_keyword ( keywords:: Auto )
5189
5189
&& self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Trait ) ) )
@@ -5445,7 +5445,7 @@ impl<'a> Parser<'a> {
5445
5445
}
5446
5446
5447
5447
/// Checks if this expression is a successfully parsed statement.
5448
- fn expr_is_complete ( & mut self , e : & Expr ) -> bool {
5448
+ fn expr_is_complete ( & self , e : & Expr ) -> bool {
5449
5449
self . restrictions . contains ( Restrictions :: STMT_EXPR ) &&
5450
5450
!classify:: expr_requires_semi_to_be_stmt ( e)
5451
5451
}
@@ -6517,7 +6517,7 @@ impl<'a> Parser<'a> {
6517
6517
Ok ( ( id, generics) )
6518
6518
}
6519
6519
6520
- fn mk_item ( & mut self , span : Span , ident : Ident , node : ItemKind , vis : Visibility ,
6520
+ fn mk_item ( & self , span : Span , ident : Ident , node : ItemKind , vis : Visibility ,
6521
6521
attrs : Vec < Attribute > ) -> P < Item > {
6522
6522
P ( Item {
6523
6523
ident,
@@ -6549,7 +6549,7 @@ impl<'a> Parser<'a> {
6549
6549
6550
6550
/// Returns `true` if we are looking at `const ID`
6551
6551
/// (returns `false` for things like `const fn`, etc.).
6552
- fn is_const_item ( & mut self ) -> bool {
6552
+ fn is_const_item ( & self ) -> bool {
6553
6553
self . token . is_keyword ( keywords:: Const ) &&
6554
6554
!self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Fn ) ) &&
6555
6555
!self . look_ahead ( 1 , |t| t. is_keyword ( keywords:: Unsafe ) )
@@ -6657,7 +6657,7 @@ impl<'a> Parser<'a> {
6657
6657
} )
6658
6658
}
6659
6659
6660
- fn complain_if_pub_macro ( & mut self , vis : & VisibilityKind , sp : Span ) {
6660
+ fn complain_if_pub_macro ( & self , vis : & VisibilityKind , sp : Span ) {
6661
6661
match * vis {
6662
6662
VisibilityKind :: Inherited => { }
6663
6663
_ => {
@@ -6686,7 +6686,7 @@ impl<'a> Parser<'a> {
6686
6686
}
6687
6687
}
6688
6688
6689
- fn missing_assoc_item_kind_err ( & mut self , item_type : & str , prev_span : Span )
6689
+ fn missing_assoc_item_kind_err ( & self , item_type : & str , prev_span : Span )
6690
6690
-> DiagnosticBuilder < ' a >
6691
6691
{
6692
6692
let expected_kinds = if item_type == "extern" {
0 commit comments