Remove unused hir_id arg from visit_attribute.

This commit is contained in:
Nicholas Nethercote 2022-06-16 07:54:03 +10:00
parent 969a2cc8c1
commit c9e97251ad
6 changed files with 9 additions and 11 deletions

View File

@ -466,7 +466,7 @@ pub trait Visitor<'v>: Sized {
fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding<'v>) {
walk_assoc_type_binding(self, type_binding)
}
fn visit_attribute(&mut self, _id: HirId, _attr: &'v Attribute) {}
fn visit_attribute(&mut self, _attr: &'v Attribute) {}
fn visit_associated_item_kind(&mut self, kind: &'v AssocItemKind) {
walk_associated_item_kind(self, kind);
}

View File

@ -21,7 +21,6 @@
use rustc_ast::{self as ast, Attribute, NestedMetaItem};
use rustc_data_structures::fx::FxHashSet;
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit;
use rustc_hir::Node as HirNode;
@ -473,7 +472,7 @@ impl<'tcx> intravisit::Visitor<'tcx> for FindAllAttrs<'tcx> {
self.tcx.hir()
}
fn visit_attribute(&mut self, _: hir::HirId, attr: &'tcx Attribute) {
fn visit_attribute(&mut self, attr: &'tcx Attribute) {
if self.is_active_attr(attr) {
self.found_attrs.push(attr);
}

View File

@ -337,7 +337,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
hir_visit::walk_path(self, p);
}
fn visit_attribute(&mut self, _hir_id: hir::HirId, attr: &'tcx ast::Attribute) {
fn visit_attribute(&mut self, attr: &'tcx ast::Attribute) {
lint_callback!(self, check_attribute, attr);
}
}
@ -400,7 +400,7 @@ fn late_lint_mod_pass<'tcx, T: LateLintPass<'tcx>>(
// Visit the crate attributes
if hir_id == hir::CRATE_HIR_ID {
for attr in tcx.hir().attrs(hir::CRATE_HIR_ID).iter() {
cx.visit_attribute(hir_id, attr)
cx.visit_attribute(attr)
}
}
}

View File

@ -577,12 +577,11 @@ impl<'hir> Map<'hir> {
/// Walks the attributes in a crate.
pub fn walk_attributes(self, visitor: &mut impl Visitor<'hir>) {
let krate = self.krate();
for (owner, info) in krate.owners.iter_enumerated() {
for info in krate.owners.iter() {
if let MaybeOwner::Owner(info) = info {
for (local_id, attrs) in info.attrs.map.iter() {
let id = HirId { owner, local_id: *local_id };
for attrs in info.attrs.map.values() {
for a in *attrs {
visitor.visit_attribute(id, a)
visitor.visit_attribute(a)
}
}
}

View File

@ -238,7 +238,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
hir_visit::walk_assoc_type_binding(self, type_binding)
}
fn visit_attribute(&mut self, _: hir::HirId, attr: &'v ast::Attribute) {
fn visit_attribute(&mut self, attr: &'v ast::Attribute) {
self.record("Attribute", Id::Attr(attr.id), attr);
}
}

View File

@ -120,7 +120,7 @@ impl<'tcx> Visitor<'tcx> for LibFeatureCollector<'tcx> {
self.tcx.hir()
}
fn visit_attribute(&mut self, _: rustc_hir::HirId, attr: &'tcx Attribute) {
fn visit_attribute(&mut self, attr: &'tcx Attribute) {
if let Some((feature, stable, span)) = self.extract(attr) {
self.collect_feature(feature, stable, span);
}