1
Fork 0

use def_span and def_kind queries instead of calling tcx.hir() methods

Signed-off-by: Miguel Guarniz <mi9uel9@gmail.com>
This commit is contained in:
Miguel Guarniz 2022-04-29 13:11:22 -04:00
parent ef1d112095
commit 3afc5ea201
17 changed files with 31 additions and 104 deletions

View file

@ -1167,7 +1167,7 @@ struct RootCollector<'a, 'tcx> {
impl<'v> RootCollector<'_, 'v> {
fn process_item(&mut self, id: hir::ItemId) {
match self.tcx.hir().def_kind(id.def_id) {
match self.tcx.def_kind(id.def_id) {
DefKind::Enum | DefKind::Struct | DefKind::Union => {
let item = self.tcx.hir().item(id);
match item.kind {
@ -1228,7 +1228,7 @@ impl<'v> RootCollector<'_, 'v> {
}
fn process_impl_item(&mut self, id: hir::ImplItemId) {
if matches!(self.tcx.hir().def_kind(id.def_id), DefKind::AssocFn) {
if matches!(self.tcx.def_kind(id.def_id), DefKind::AssocFn) {
self.push_if_root(id.def_id);
}
}