Skip to content

Commit 9b4a630

Browse files
committed
syntax::parse::parser: convert unnecessary '&mut self's to '&self'.
1 parent 0535e42 commit 9b4a630

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/libsyntax/parse/parser.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -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),
@@ -2471,27 +2471,27 @@ impl<'a> Parser<'a> {
24712471
})
24722472
}
24732473

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> {
24752475
P(Expr { node, span, attrs, id: ast::DUMMY_NODE_ID })
24762476
}
24772477

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 {
24792479
ExprKind::Unary(unop, expr)
24802480
}
24812481

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 {
24832483
ExprKind::Binary(binop, lhs, rhs)
24842484
}
24852485

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 {
24872487
ExprKind::Call(f, args)
24882488
}
24892489

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 {
24912491
ExprKind::Index(expr, idx)
24922492
}
24932493

2494-
fn mk_range(&mut self,
2494+
fn mk_range(&self,
24952495
start: Option<P<Expr>>,
24962496
end: Option<P<Expr>>,
24972497
limits: RangeLimits)
@@ -2503,7 +2503,7 @@ impl<'a> Parser<'a> {
25032503
}
25042504
}
25052505

2506-
fn mk_assign_op(&mut self, binop: ast::BinOp,
2506+
fn mk_assign_op(&self, binop: ast::BinOp,
25072507
lhs: P<Expr>, rhs: P<Expr>) -> ast::ExprKind {
25082508
ExprKind::AssignOp(binop, lhs, rhs)
25092509
}
@@ -3840,7 +3840,7 @@ impl<'a> Parser<'a> {
38403840
/// Produce an error if comparison operators are chained (RFC #558).
38413841
/// We only need to check lhs, not rhs, because all comparison ops
38423842
/// 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) {
38443844
debug_assert!(outer_op.is_comparison(),
38453845
"check_no_chained_comparison: {:?} is not comparison",
38463846
outer_op);
@@ -5137,7 +5137,7 @@ impl<'a> Parser<'a> {
51375137
})
51385138
}
51395139

5140-
fn is_async_block(&mut self) -> bool {
5140+
fn is_async_block(&self) -> bool {
51415141
self.token.is_keyword(keywords::Async) &&
51425142
(
51435143
( // `async move {`
@@ -5149,19 +5149,19 @@ impl<'a> Parser<'a> {
51495149
)
51505150
}
51515151

5152-
fn is_async_fn(&mut self) -> bool {
5152+
fn is_async_fn(&self) -> bool {
51535153
self.token.is_keyword(keywords::Async) &&
51545154
self.look_ahead(1, |t| t.is_keyword(keywords::Fn))
51555155
}
51565156

5157-
fn is_do_catch_block(&mut self) -> bool {
5157+
fn is_do_catch_block(&self) -> bool {
51585158
self.token.is_keyword(keywords::Do) &&
51595159
self.look_ahead(1, |t| t.is_keyword(keywords::Catch)) &&
51605160
self.look_ahead(2, |t| *t == token::OpenDelim(token::Brace)) &&
51615161
!self.restrictions.contains(Restrictions::NO_STRUCT_LITERAL)
51625162
}
51635163

5164-
fn is_try_block(&mut self) -> bool {
5164+
fn is_try_block(&self) -> bool {
51655165
self.token.is_keyword(keywords::Try) &&
51665166
self.look_ahead(1, |t| *t == token::OpenDelim(token::Brace)) &&
51675167
self.span.rust_2018() &&
@@ -5183,7 +5183,7 @@ impl<'a> Parser<'a> {
51835183
self.look_ahead(1, |t| t.is_keyword(keywords::Type))
51845184
}
51855185

5186-
fn is_auto_trait_item(&mut self) -> bool {
5186+
fn is_auto_trait_item(&self) -> bool {
51875187
// auto trait
51885188
(self.token.is_keyword(keywords::Auto)
51895189
&& self.look_ahead(1, |t| t.is_keyword(keywords::Trait)))
@@ -5445,7 +5445,7 @@ impl<'a> Parser<'a> {
54455445
}
54465446

54475447
/// 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 {
54495449
self.restrictions.contains(Restrictions::STMT_EXPR) &&
54505450
!classify::expr_requires_semi_to_be_stmt(e)
54515451
}
@@ -6517,7 +6517,7 @@ impl<'a> Parser<'a> {
65176517
Ok((id, generics))
65186518
}
65196519

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,
65216521
attrs: Vec<Attribute>) -> P<Item> {
65226522
P(Item {
65236523
ident,
@@ -6549,7 +6549,7 @@ impl<'a> Parser<'a> {
65496549

65506550
/// Returns `true` if we are looking at `const ID`
65516551
/// (returns `false` for things like `const fn`, etc.).
6552-
fn is_const_item(&mut self) -> bool {
6552+
fn is_const_item(&self) -> bool {
65536553
self.token.is_keyword(keywords::Const) &&
65546554
!self.look_ahead(1, |t| t.is_keyword(keywords::Fn)) &&
65556555
!self.look_ahead(1, |t| t.is_keyword(keywords::Unsafe))
@@ -6657,7 +6657,7 @@ impl<'a> Parser<'a> {
66576657
})
66586658
}
66596659

6660-
fn complain_if_pub_macro(&mut self, vis: &VisibilityKind, sp: Span) {
6660+
fn complain_if_pub_macro(&self, vis: &VisibilityKind, sp: Span) {
66616661
match *vis {
66626662
VisibilityKind::Inherited => {}
66636663
_ => {
@@ -6686,7 +6686,7 @@ impl<'a> Parser<'a> {
66866686
}
66876687
}
66886688

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)
66906690
-> DiagnosticBuilder<'a>
66916691
{
66926692
let expected_kinds = if item_type == "extern" {

0 commit comments

Comments
 (0)