Skip to content

Commit 3fcac2c

Browse files
committed
from_over_into: Check HIR tree first.
1 parent 278e837 commit 3fcac2c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

clippy_lints/src/from_over_into.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ impl_lint_pass!(FromOverInto => [FROM_OVER_INTO]);
6464

6565
impl<'tcx> LateLintPass<'tcx> for FromOverInto {
6666
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
67-
if !self.msrv.meets(msrvs::RE_REBALANCING_COHERENCE) || !span_is_local(item.span) {
68-
return;
69-
}
70-
7167
if let ItemKind::Impl(Impl {
7268
of_trait: Some(hir_trait_ref),
7369
self_ty,
@@ -77,6 +73,8 @@ impl<'tcx> LateLintPass<'tcx> for FromOverInto {
7773
&& let Some(into_trait_seg) = hir_trait_ref.path.segments.last()
7874
// `impl Into<target_ty> for self_ty`
7975
&& let Some(GenericArgs { args: [GenericArg::Type(target_ty)], .. }) = into_trait_seg.args
76+
&& self.msrv.meets(msrvs::RE_REBALANCING_COHERENCE)
77+
&& span_is_local(item.span)
8078
&& let Some(middle_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id)
8179
.map(ty::EarlyBinder::instantiate_identity)
8280
&& cx.tcx.is_diagnostic_item(sym::Into, middle_trait_ref.def_id)

0 commit comments

Comments
 (0)