Skip to content

Commit 301ce36

Browse files
committed
Limit non local defs lint logic to only impls and macros
1 parent b0d3e04 commit 301ce36

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_lint/src/non_local_def.rs

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
6767
return;
6868
}
6969

70+
if !matches!(item.kind, ItemKind::Impl(_) | ItemKind::Macro(_, _)) {
71+
return;
72+
}
73+
7074
let parent = cx.tcx.parent(item.owner_id.def_id.into());
7175
let parent_def_kind = cx.tcx.def_kind(parent);
7276
let parent_opt_item_name = cx.tcx.opt_item_name(parent);

0 commit comments

Comments
 (0)