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

@ -389,7 +389,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
hir_visit::walk_fn(self, fk, fd, b, id)
}
fn visit_use(&mut self, p: &'v hir::UsePath<'v>, hir_id: hir::HirId) {
fn visit_use(&mut self, p: &'v hir::UsePath<'v>, hir_id: HirId) {
// This is `visit_use`, but the type is `Path` so record it that way.
self.record("Path", Id::None, p);
hir_visit::walk_use(self, p, hir_id)
@ -462,7 +462,7 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
hir_visit::walk_lifetime(self, lifetime)
}
fn visit_path(&mut self, path: &hir::Path<'v>, _id: hir::HirId) {
fn visit_path(&mut self, path: &hir::Path<'v>, _id: HirId) {
self.record("Path", Id::None, path);
hir_visit::walk_path(self, path)
}

View file

@ -602,7 +602,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
String::from_utf8(wr).unwrap()
}
fn log_liveness(&self, entry_ln: LiveNode, hir_id: hir::HirId) {
fn log_liveness(&self, entry_ln: LiveNode, hir_id: HirId) {
// hack to skip the loop unless debug! is enabled:
debug!(
"^^ liveness computation results for body {} (entry={:?})",

View file

@ -5,7 +5,7 @@ use rustc_hir as hir;
use rustc_hir::def::DefKind;
use rustc_hir::def_id::{LocalDefId, LocalModDefId};
use rustc_hir::intravisit::Visitor;
use rustc_hir::{ExprKind, InlineAsmOperand, StmtKind};
use rustc_hir::{ExprKind, HirIdSet, InlineAsmOperand, StmtKind};
use rustc_middle::query::Providers;
use rustc_middle::ty::TyCtxt;
use rustc_session::lint::builtin::UNDEFINED_NAKED_FUNCTION_ABI;
@ -94,7 +94,7 @@ fn check_no_patterns(tcx: TyCtxt<'_>, params: &[hir::Param<'_>]) {
/// Checks that function parameters aren't used in the function body.
fn check_no_parameters_use<'tcx>(tcx: TyCtxt<'tcx>, body: &'tcx hir::Body<'tcx>) {
let mut params = hir::HirIdSet::default();
let mut params = HirIdSet::default();
for param in body.params {
param.pat.each_binding(|_binding_mode, hir_id, _span, _ident| {
params.insert(hir_id);
@ -105,7 +105,7 @@ fn check_no_parameters_use<'tcx>(tcx: TyCtxt<'tcx>, body: &'tcx hir::Body<'tcx>)
struct CheckParameters<'tcx> {
tcx: TyCtxt<'tcx>,
params: hir::HirIdSet,
params: HirIdSet,
}
impl<'tcx> Visitor<'tcx> for CheckParameters<'tcx> {

View file

@ -66,7 +66,7 @@ impl CaptureCollector<'_, '_> {
}
impl<'tcx> Visitor<'tcx> for CaptureCollector<'_, 'tcx> {
fn visit_path(&mut self, path: &hir::Path<'tcx>, _: hir::HirId) {
fn visit_path(&mut self, path: &hir::Path<'tcx>, _: HirId) {
if let Res::Local(var_id) = path.res {
self.visit_local_use(var_id, path.span);
}