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:
parent
26eeeeec76
commit
efca32e23a
46 changed files with 115 additions and 115 deletions
|
|
@ -88,7 +88,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
|
|||
return;
|
||||
}
|
||||
|
||||
if !cx.effective_visibilities.is_exported(it.def_id.def_id) {
|
||||
if !cx.effective_visibilities.is_exported(it.owner_id.def_id) {
|
||||
return;
|
||||
}
|
||||
match it.kind {
|
||||
|
|
@ -105,7 +105,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
|
|||
match tit_.kind {
|
||||
hir::TraitItemKind::Const(..) | hir::TraitItemKind::Type(..) => {},
|
||||
hir::TraitItemKind::Fn(..) => {
|
||||
if cx.tcx.impl_defaultness(tit.id.def_id).has_value() {
|
||||
if cx.tcx.impl_defaultness(tit.id.owner_id).has_value() {
|
||||
// trait method with default body needs inline in case
|
||||
// an impl is not provided
|
||||
let desc = "a default trait method";
|
||||
|
|
@ -142,7 +142,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
|
|||
}
|
||||
|
||||
// If the item being implemented is not exported, then we don't need #[inline]
|
||||
if !cx.effective_visibilities.is_exported(impl_item.def_id.def_id) {
|
||||
if !cx.effective_visibilities.is_exported(impl_item.owner_id.def_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
|
|||
hir::ImplItemKind::Const(..) | hir::ImplItemKind::Type(_) => return,
|
||||
};
|
||||
|
||||
let assoc_item = cx.tcx.associated_item(impl_item.def_id);
|
||||
let assoc_item = cx.tcx.associated_item(impl_item.owner_id);
|
||||
let container_id = assoc_item.container_id(cx.tcx);
|
||||
let trait_def_id = match assoc_item.container {
|
||||
TraitContainer => Some(container_id),
|
||||
|
|
@ -159,7 +159,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingInline {
|
|||
};
|
||||
|
||||
if let Some(trait_def_id) = trait_def_id {
|
||||
if trait_def_id.is_local() && !cx.effective_visibilities.is_exported(impl_item.def_id.def_id) {
|
||||
if trait_def_id.is_local() && !cx.effective_visibilities.is_exported(impl_item.owner_id.def_id) {
|
||||
// If a trait is being implemented for an item, and the
|
||||
// trait is not exported, we don't need #[inline]
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue