diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-24 19:39:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-24 19:39:15 +0200 |
| commit | a8cea36240faa510359e0fae732ee94186d13273 (patch) | |
| tree | 2f9c348eb72f739d6f3e7432e2bef67b02144bbb /compiler/rustc_lint/src | |
| parent | c309366e5fbbaa33d5ca4207ac1bd834fcc5db34 (diff) | |
| parent | 0635916cbe22b96708abe40499d03aef4901ad6a (diff) | |
| download | rust-a8cea36240faa510359e0fae732ee94186d13273.tar.gz rust-a8cea36240faa510359e0fae732ee94186d13273.zip | |
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
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/early.rs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/compiler/rustc_lint/src/early.rs b/compiler/rustc_lint/src/early.rs index 2285877c9ef..c095199a471 100644 --- a/compiler/rustc_lint/src/early.rs +++ b/compiler/rustc_lint/src/early.rs @@ -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| { lint_callback!(cx, check_expr, 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) { lint_callback!(self, check_generic_arg, arg); ast_visit::walk_generic_arg(self, arg); |
