1
Fork 0

Rename some OwnerId fields.

spastorino noticed some silly expressions like `item_id.def_id.def_id`.

This commit renames several `def_id: OwnerId` fields as `owner_id`, so
those expressions become `item_id.owner_id.def_id`.

`item_id.owner_id.local_def_id` would be even clearer, but the use of
`def_id` for values of type `LocalDefId` is *very* widespread, so I left
that alone.
This commit is contained in:
Nicholas Nethercote 2022-10-27 14:02:18 +11:00
parent 33b55ac39f
commit c8c25ce5a1
107 changed files with 618 additions and 603 deletions

View file

@ -156,14 +156,14 @@ impl<'tcx> InherentOverlapChecker<'tcx> {
}
fn check_item(&mut self, id: hir::ItemId) {
let def_kind = self.tcx.def_kind(id.def_id);
let def_kind = self.tcx.def_kind(id.owner_id);
if !matches!(def_kind, DefKind::Enum | DefKind::Struct | DefKind::Trait | DefKind::Union) {
return;
}
let impls = self.tcx.inherent_impls(id.def_id);
let impls = self.tcx.inherent_impls(id.owner_id);
let overlap_mode = OverlapMode::get(self.tcx, id.def_id.to_def_id());
let overlap_mode = OverlapMode::get(self.tcx, id.owner_id.to_def_id());
let impls_items = impls
.iter()