Skip to content

Commit 5d477fb

Browse files
committed
Optimize for the Type first
1 parent 8df3e4e commit 5d477fb

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

compiler/rustc_lint/src/non_local_def.rs

+12-11
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,18 @@ impl<'tcx> LateLintPass<'tcx> for NonLocalDefinitions {
175175
| TyKind::Err(_) => false,
176176
};
177177

178-
let of_trait_has_local_parent = impl_
179-
.of_trait
180-
.map(|of_trait| {
181-
path_has_local_parent(
182-
of_trait.path,
183-
cx,
184-
&mut parent_owner,
185-
&mut extra_local_parent,
186-
)
187-
})
188-
.unwrap_or(false);
178+
let of_trait_has_local_parent = self_ty_has_local_parent
179+
|| impl_
180+
.of_trait
181+
.map(|of_trait| {
182+
path_has_local_parent(
183+
of_trait.path,
184+
cx,
185+
&mut parent_owner,
186+
&mut extra_local_parent,
187+
)
188+
})
189+
.unwrap_or(false);
189190

190191
// If none of them have a local parent (LOGICAL NOR) this means that
191192
// this impl definition is a non-local definition and so we lint on it.

0 commit comments

Comments
 (0)