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
33b55ac39f
commit
c8c25ce5a1
107 changed files with 618 additions and 603 deletions
|
@ -89,11 +89,11 @@ fn unused_crates_lint(tcx: TyCtxt<'_>) {
|
|||
let mut crates_to_lint = vec![];
|
||||
|
||||
for id in tcx.hir().items() {
|
||||
if matches!(tcx.def_kind(id.def_id), DefKind::ExternCrate) {
|
||||
if matches!(tcx.def_kind(id.owner_id), DefKind::ExternCrate) {
|
||||
let item = tcx.hir().item(id);
|
||||
if let hir::ItemKind::ExternCrate(orig_name) = item.kind {
|
||||
crates_to_lint.push(ExternCrateToLint {
|
||||
def_id: item.def_id.to_def_id(),
|
||||
def_id: item.owner_id.to_def_id(),
|
||||
span: item.span,
|
||||
orig_name,
|
||||
warn_if_unused: !item.ident.as_str().starts_with('_'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue