mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Rollup merge of #132107 - maxcabrajac:remove_expr_post, r=petrochenkov
Remove visit_expr_post from ast Visitor `visit_expr_post` is only present in the immutable version of ast Visitors and its default implementation is a noop. Given that its only implementer is on `rustc_lint/src/early.rs` and its name follows the same naming convention as some other lints (`_post`), it seems that `visit_expr_post` being in `Visitor` was a little mistake. r? `@petrochenkov` related to #128974
This commit is contained in:
commit
a8cea36240
@ -173,9 +173,6 @@ pub trait Visitor<'ast>: Sized {
|
|||||||
fn visit_method_receiver_expr(&mut self, ex: &'ast Expr) -> Self::Result {
|
fn visit_method_receiver_expr(&mut self, ex: &'ast Expr) -> Self::Result {
|
||||||
self.visit_expr(ex)
|
self.visit_expr(ex)
|
||||||
}
|
}
|
||||||
fn visit_expr_post(&mut self, _ex: &'ast Expr) -> Self::Result {
|
|
||||||
Self::Result::output()
|
|
||||||
}
|
|
||||||
fn visit_ty(&mut self, t: &'ast Ty) -> Self::Result {
|
fn visit_ty(&mut self, t: &'ast Ty) -> Self::Result {
|
||||||
walk_ty(self, t)
|
walk_ty(self, t)
|
||||||
}
|
}
|
||||||
@ -1185,7 +1182,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V
|
|||||||
ExprKind::Dummy => {}
|
ExprKind::Dummy => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
visitor.visit_expr_post(expression)
|
V::Result::output()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn walk_param<'a, V: Visitor<'a>>(visitor: &mut V, param: &'a Param) -> V::Result {
|
pub fn walk_param<'a, V: Visitor<'a>>(visitor: &mut V, param: &'a Param) -> V::Result {
|
||||||
|
@ -121,6 +121,18 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
|
|||||||
self.with_lint_attrs(e.id, &e.attrs, |cx| {
|
self.with_lint_attrs(e.id, &e.attrs, |cx| {
|
||||||
lint_callback!(cx, check_expr, e);
|
lint_callback!(cx, check_expr, e);
|
||||||
ast_visit::walk_expr(cx, e);
|
ast_visit::walk_expr(cx, e);
|
||||||
|
// Explicitly check for lints associated with 'closure_id', since
|
||||||
|
// it does not have a corresponding AST node
|
||||||
|
match e.kind {
|
||||||
|
ast::ExprKind::Closure(box ast::Closure {
|
||||||
|
coroutine_kind: Some(coroutine_kind),
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
|
cx.check_id(coroutine_kind.closure_id());
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
lint_callback!(cx, check_expr_post, e);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,21 +226,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_expr_post(&mut self, e: &'a ast::Expr) {
|
|
||||||
// Explicitly check for lints associated with 'closure_id', since
|
|
||||||
// it does not have a corresponding AST node
|
|
||||||
match e.kind {
|
|
||||||
ast::ExprKind::Closure(box ast::Closure {
|
|
||||||
coroutine_kind: Some(coroutine_kind),
|
|
||||||
..
|
|
||||||
}) => {
|
|
||||||
self.check_id(coroutine_kind.closure_id());
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
lint_callback!(self, check_expr_post, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_generic_arg(&mut self, arg: &'a ast::GenericArg) {
|
fn visit_generic_arg(&mut self, arg: &'a ast::GenericArg) {
|
||||||
lint_callback!(self, check_generic_arg, arg);
|
lint_callback!(self, check_generic_arg, arg);
|
||||||
ast_visit::walk_generic_arg(self, arg);
|
ast_visit::walk_generic_arg(self, arg);
|
||||||
|
Loading…
Reference in New Issue
Block a user