1
Fork 0

Remove some early check_* functions.

They're not used by rustc or clippy.
This commit is contained in:
Nicholas Nethercote 2022-07-29 10:25:49 +10:00
parent bdf520fd41
commit ab44b5a408
2 changed files with 0 additions and 36 deletions

View file

@ -90,9 +90,7 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
fn visit_foreign_item(&mut self, it: &'a ast::ForeignItem) { fn visit_foreign_item(&mut self, it: &'a ast::ForeignItem) {
self.with_lint_attrs(it.id, &it.attrs, |cx| { self.with_lint_attrs(it.id, &it.attrs, |cx| {
run_early_pass!(cx, check_foreign_item, it);
ast_visit::walk_foreign_item(cx, it); ast_visit::walk_foreign_item(cx, it);
run_early_pass!(cx, check_foreign_item_post, it);
}) })
} }
@ -104,7 +102,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
} }
fn visit_anon_const(&mut self, c: &'a ast::AnonConst) { fn visit_anon_const(&mut self, c: &'a ast::AnonConst) {
run_early_pass!(self, check_anon_const, c);
self.check_id(c.id); self.check_id(c.id);
ast_visit::walk_anon_const(self, c); ast_visit::walk_anon_const(self, c);
} }
@ -154,22 +151,17 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
self.check_id(closure_id); self.check_id(closure_id);
} }
} }
run_early_pass!(self, check_fn_post, fk, span, id);
} }
fn visit_variant_data(&mut self, s: &'a ast::VariantData) { fn visit_variant_data(&mut self, s: &'a ast::VariantData) {
run_early_pass!(self, check_struct_def, s);
if let Some(ctor_hir_id) = s.ctor_id() { if let Some(ctor_hir_id) = s.ctor_id() {
self.check_id(ctor_hir_id); self.check_id(ctor_hir_id);
} }
ast_visit::walk_struct_def(self, s); ast_visit::walk_struct_def(self, s);
run_early_pass!(self, check_struct_def_post, s);
} }
fn visit_field_def(&mut self, s: &'a ast::FieldDef) { fn visit_field_def(&mut self, s: &'a ast::FieldDef) {
self.with_lint_attrs(s.id, &s.attrs, |cx| { self.with_lint_attrs(s.id, &s.attrs, |cx| {
run_early_pass!(cx, check_field_def, s);
ast_visit::walk_field_def(cx, s); ast_visit::walk_field_def(cx, s);
}) })
} }
@ -178,7 +170,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
self.with_lint_attrs(v.id, &v.attrs, |cx| { self.with_lint_attrs(v.id, &v.attrs, |cx| {
run_early_pass!(cx, check_variant, v); run_early_pass!(cx, check_variant, v);
ast_visit::walk_variant(cx, v); ast_visit::walk_variant(cx, v);
run_early_pass!(cx, check_variant_post, v);
}) })
} }
@ -203,7 +194,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
run_early_pass!(self, check_block, b); run_early_pass!(self, check_block, b);
self.check_id(b.id); self.check_id(b.id);
ast_visit::walk_block(self, b); ast_visit::walk_block(self, b);
run_early_pass!(self, check_block_post, b);
} }
fn visit_arm(&mut self, a: &'a ast::Arm) { fn visit_arm(&mut self, a: &'a ast::Arm) {
@ -214,8 +204,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
} }
fn visit_expr_post(&mut self, e: &'a ast::Expr) { fn visit_expr_post(&mut self, e: &'a ast::Expr) {
run_early_pass!(self, check_expr_post, e);
// Explicitly check for lints associated with 'closure_id', since // Explicitly check for lints associated with 'closure_id', since
// it does not have a corresponding AST node // it does not have a corresponding AST node
match e.kind { match e.kind {
@ -242,7 +230,6 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
} }
fn visit_where_predicate(&mut self, p: &'a ast::WherePredicate) { fn visit_where_predicate(&mut self, p: &'a ast::WherePredicate) {
run_early_pass!(self, check_where_predicate, p);
ast_visit::walk_where_predicate(self, p); ast_visit::walk_where_predicate(self, p);
} }
@ -256,23 +243,19 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
ast_visit::AssocCtxt::Trait => { ast_visit::AssocCtxt::Trait => {
run_early_pass!(cx, check_trait_item, item); run_early_pass!(cx, check_trait_item, item);
ast_visit::walk_assoc_item(cx, item, ctxt); ast_visit::walk_assoc_item(cx, item, ctxt);
run_early_pass!(cx, check_trait_item_post, item);
} }
ast_visit::AssocCtxt::Impl => { ast_visit::AssocCtxt::Impl => {
run_early_pass!(cx, check_impl_item, item); run_early_pass!(cx, check_impl_item, item);
ast_visit::walk_assoc_item(cx, item, ctxt); ast_visit::walk_assoc_item(cx, item, ctxt);
run_early_pass!(cx, check_impl_item_post, item);
} }
}); });
} }
fn visit_lifetime(&mut self, lt: &'a ast::Lifetime, _: ast_visit::LifetimeCtxt) { fn visit_lifetime(&mut self, lt: &'a ast::Lifetime, _: ast_visit::LifetimeCtxt) {
run_early_pass!(self, check_lifetime, lt);
self.check_id(lt.id); self.check_id(lt.id);
} }
fn visit_path(&mut self, p: &'a ast::Path, id: ast::NodeId) { fn visit_path(&mut self, p: &'a ast::Path, id: ast::NodeId) {
run_early_pass!(self, check_path, p, id);
self.check_id(id); self.check_id(id);
ast_visit::walk_path(self, p); ast_visit::walk_path(self, p);
} }

View file

@ -161,44 +161,25 @@ macro_rules! early_lint_methods {
fn check_ident(a: Ident); fn check_ident(a: Ident);
fn check_crate(a: &ast::Crate); fn check_crate(a: &ast::Crate);
fn check_crate_post(a: &ast::Crate); fn check_crate_post(a: &ast::Crate);
fn check_foreign_item(a: &ast::ForeignItem);
fn check_foreign_item_post(a: &ast::ForeignItem);
fn check_item(a: &ast::Item); fn check_item(a: &ast::Item);
fn check_item_post(a: &ast::Item); fn check_item_post(a: &ast::Item);
fn check_local(a: &ast::Local); fn check_local(a: &ast::Local);
fn check_block(a: &ast::Block); fn check_block(a: &ast::Block);
fn check_block_post(a: &ast::Block);
fn check_stmt(a: &ast::Stmt); fn check_stmt(a: &ast::Stmt);
fn check_arm(a: &ast::Arm); fn check_arm(a: &ast::Arm);
fn check_pat(a: &ast::Pat); fn check_pat(a: &ast::Pat);
fn check_anon_const(a: &ast::AnonConst);
fn check_pat_post(a: &ast::Pat); fn check_pat_post(a: &ast::Pat);
fn check_expr(a: &ast::Expr); fn check_expr(a: &ast::Expr);
fn check_expr_post(a: &ast::Expr);
fn check_ty(a: &ast::Ty); fn check_ty(a: &ast::Ty);
fn check_generic_arg(a: &ast::GenericArg); fn check_generic_arg(a: &ast::GenericArg);
fn check_generic_param(a: &ast::GenericParam); fn check_generic_param(a: &ast::GenericParam);
fn check_generics(a: &ast::Generics); fn check_generics(a: &ast::Generics);
fn check_where_predicate(a: &ast::WherePredicate);
fn check_poly_trait_ref(a: &ast::PolyTraitRef, fn check_poly_trait_ref(a: &ast::PolyTraitRef,
b: &ast::TraitBoundModifier); b: &ast::TraitBoundModifier);
fn check_fn(a: rustc_ast::visit::FnKind<'_>, c: Span, d_: ast::NodeId); fn check_fn(a: rustc_ast::visit::FnKind<'_>, c: Span, d_: ast::NodeId);
fn check_fn_post(
a: rustc_ast::visit::FnKind<'_>,
c: Span,
d: ast::NodeId
);
fn check_trait_item(a: &ast::AssocItem); fn check_trait_item(a: &ast::AssocItem);
fn check_trait_item_post(a: &ast::AssocItem);
fn check_impl_item(a: &ast::AssocItem); fn check_impl_item(a: &ast::AssocItem);
fn check_impl_item_post(a: &ast::AssocItem);
fn check_struct_def(a: &ast::VariantData);
fn check_struct_def_post(a: &ast::VariantData);
fn check_field_def(a: &ast::FieldDef);
fn check_variant(a: &ast::Variant); fn check_variant(a: &ast::Variant);
fn check_variant_post(a: &ast::Variant);
fn check_lifetime(a: &ast::Lifetime);
fn check_path(a: &ast::Path, b: ast::NodeId);
fn check_attribute(a: &ast::Attribute); fn check_attribute(a: &ast::Attribute);
fn check_mac_def(a: &ast::MacroDef, b: ast::NodeId); fn check_mac_def(a: &ast::MacroDef, b: ast::NodeId);
fn check_mac(a: &ast::MacCall); fn check_mac(a: &ast::MacCall);