1
Fork 0

Avoid lots of hir::HirId{,Map,Set} qualifiers.

Because they're a bit redundant.
This commit is contained in:
Nicholas Nethercote 2024-03-06 17:24:13 +11:00
parent e93f754289
commit 4b27cc8b7a
36 changed files with 276 additions and 312 deletions

View file

@ -20,6 +20,7 @@ use rustc_data_structures::sync::{join, Lrc};
use rustc_hir as hir;
use rustc_hir::def_id::{LocalDefId, LocalModDefId};
use rustc_hir::intravisit as hir_visit;
use rustc_hir::HirId;
use rustc_middle::hir::nested_filter;
use rustc_middle::ty::{self, TyCtxt};
use rustc_session::lint::LintPass;
@ -53,7 +54,7 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
/// Merge the lints specified by any lint attributes into the
/// current lint context, call the provided function, then reset the
/// lints in effect to their previous state.
fn with_lint_attrs<F>(&mut self, id: hir::HirId, f: F)
fn with_lint_attrs<F>(&mut self, id: HirId, f: F)
where
F: FnOnce(&mut Self),
{
@ -81,7 +82,7 @@ impl<'tcx, T: LateLintPass<'tcx>> LateContextAndPass<'tcx, T> {
self.context.param_env = old_param_env;
}
fn process_mod(&mut self, m: &'tcx hir::Mod<'tcx>, n: hir::HirId) {
fn process_mod(&mut self, m: &'tcx hir::Mod<'tcx>, n: HirId) {
lint_callback!(self, check_mod, m, n);
hir_visit::walk_mod(self, m, n);
}
@ -231,7 +232,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
hir_visit::walk_inf(self, inf);
}
fn visit_mod(&mut self, m: &'tcx hir::Mod<'tcx>, _: Span, n: hir::HirId) {
fn visit_mod(&mut self, m: &'tcx hir::Mod<'tcx>, _: Span, n: HirId) {
if !self.context.only_module {
self.process_mod(m, n);
}
@ -305,7 +306,7 @@ impl<'tcx, T: LateLintPass<'tcx>> hir_visit::Visitor<'tcx> for LateContextAndPas
hir_visit::walk_lifetime(self, lt);
}
fn visit_path(&mut self, p: &hir::Path<'tcx>, id: hir::HirId) {
fn visit_path(&mut self, p: &hir::Path<'tcx>, id: HirId) {
lint_callback!(self, check_path, p, id);
hir_visit::walk_path(self, p);
}