Skip to content

Commit

Permalink
Limit non local defs lint logic to only impls and macros
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Feb 26, 2024
1 parent b0d3e04 commit 301ce36
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_lint/src/non_local_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
return;
}

if !matches!(item.kind, ItemKind::Impl(_) | ItemKind::Macro(_, _)) {
return;
}

let parent = cx.tcx.parent(item.owner_id.def_id.into());
let parent_def_kind = cx.tcx.def_kind(parent);
let parent_opt_item_name = cx.tcx.opt_item_name(parent);
Expand Down

0 comments on commit 301ce36

Please sign in to comment.