Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillot
Simplify visitors By removing some unused arguments. r? `@cjgillot`
This commit is contained in:
commit
8237efc52d
20 changed files with 60 additions and 180 deletions
|
@ -233,9 +233,9 @@ impl<'a, T: EarlyLintPass> ast_visit::Visitor<'a> for EarlyContextAndPass<'a, T>
|
|||
ast_visit::walk_where_predicate(self, p);
|
||||
}
|
||||
|
||||
fn visit_poly_trait_ref(&mut self, t: &'a ast::PolyTraitRef, m: &'a ast::TraitBoundModifier) {
|
||||
run_early_pass!(self, check_poly_trait_ref, t, m);
|
||||
ast_visit::walk_poly_trait_ref(self, t, m);
|
||||
fn visit_poly_trait_ref(&mut self, t: &'a ast::PolyTraitRef) {
|
||||
run_early_pass!(self, check_poly_trait_ref, t);
|
||||
ast_visit::walk_poly_trait_ref(self, t);
|
||||
}
|
||||
|
||||
fn visit_assoc_item(&mut self, item: &'a ast::AssocItem, ctxt: ast_visit::AssocCtxt) {
|
||||
|
|
|
@ -24,7 +24,6 @@ use rustc_hir::intravisit::Visitor;
|
|||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_session::lint::LintPass;
|
||||
use rustc_span::symbol::Symbol;
|
||||
use rustc_span::Span;
|
||||
|
||||
use std::any::Any;
|
||||
|
@ -194,14 +193,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
|
|||
self.context.cached_typeck_results.set(old_cached_typeck_results);
|
||||
}
|
||||
|
||||
fn visit_variant_data(
|
||||
&mut self,
|
||||
s: &'tcx hir::VariantData<'tcx>,
|
||||
_: Symbol,
|
||||
_: &'tcx hir::Generics<'tcx>,
|
||||
_: hir::HirId,
|
||||
_: Span,
|
||||
) {
|
||||
fn visit_variant_data(&mut self, s: &'tcx hir::VariantData<'tcx>) {
|
||||
lint_callback!(self, check_struct_def, s);
|
||||
hir_visit::walk_struct_def(self, s);
|
||||
}
|
||||
|
@ -213,15 +205,10 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
|
|||
})
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'tcx hir::Variant<'tcx>,
|
||||
g: &'tcx hir::Generics<'tcx>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
fn visit_variant(&mut self, v: &'tcx hir::Variant<'tcx>) {
|
||||
self.with_lint_attrs(v.id, |cx| {
|
||||
lint_callback!(cx, check_variant, v);
|
||||
hir_visit::walk_variant(cx, v, g, item_id);
|
||||
hir_visit::walk_variant(cx, v);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -772,14 +772,9 @@ impl<'tcx> intravisit::Visitor<'tcx> for LintLevelMapBuilder<'tcx> {
|
|||
})
|
||||
}
|
||||
|
||||
fn visit_variant(
|
||||
&mut self,
|
||||
v: &'tcx hir::Variant<'tcx>,
|
||||
g: &'tcx hir::Generics<'tcx>,
|
||||
item_id: hir::HirId,
|
||||
) {
|
||||
fn visit_variant(&mut self, v: &'tcx hir::Variant<'tcx>) {
|
||||
self.with_lint_attrs(v.id, |builder| {
|
||||
intravisit::walk_variant(builder, v, g, item_id);
|
||||
intravisit::walk_variant(builder, v);
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -156,8 +156,7 @@ macro_rules! early_lint_methods {
|
|||
fn check_generic_arg(a: &ast::GenericArg);
|
||||
fn check_generic_param(a: &ast::GenericParam);
|
||||
fn check_generics(a: &ast::Generics);
|
||||
fn check_poly_trait_ref(a: &ast::PolyTraitRef,
|
||||
b: &ast::TraitBoundModifier);
|
||||
fn check_poly_trait_ref(a: &ast::PolyTraitRef);
|
||||
fn check_fn(a: rustc_ast::visit::FnKind<'_>, c: Span, d_: ast::NodeId);
|
||||
fn check_trait_item(a: &ast::AssocItem);
|
||||
fn check_impl_item(a: &ast::AssocItem);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue