diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2024-06-11 14:10:10 -0400 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2024-07-05 03:12:49 -0400 |
| commit | 3fcac2cba8ec697a8377336e765d704d710c8e60 (patch) | |
| tree | 75aaa5b1a8bcaa35fd5e34108a93006447e0aa06 | |
| parent | 278e8371e64e09b684127054a78b0166074b5e9b (diff) | |
| download | rust-3fcac2cba8ec697a8377336e765d704d710c8e60.tar.gz rust-3fcac2cba8ec697a8377336e765d704d710c8e60.zip | |
`from_over_into`: Check HIR tree first.
| -rw-r--r-- | clippy_lints/src/from_over_into.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clippy_lints/src/from_over_into.rs b/clippy_lints/src/from_over_into.rs index 93527bcdf5c..618530136e2 100644 --- a/clippy_lints/src/from_over_into.rs +++ b/clippy_lints/src/from_over_into.rs @@ -64,10 +64,6 @@ impl_lint_pass!(FromOverInto => [FROM_OVER_INTO]); impl<'tcx> LateLintPass<'tcx> for FromOverInto { fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) { - if !self.msrv.meets(msrvs::RE_REBALANCING_COHERENCE) || !span_is_local(item.span) { - return; - } - if let ItemKind::Impl(Impl { of_trait: Some(hir_trait_ref), self_ty, @@ -77,6 +73,8 @@ impl<'tcx> LateLintPass<'tcx> for FromOverInto { && let Some(into_trait_seg) = hir_trait_ref.path.segments.last() // `impl Into<target_ty> for self_ty` && let Some(GenericArgs { args: [GenericArg::Type(target_ty)], .. }) = into_trait_seg.args + && self.msrv.meets(msrvs::RE_REBALANCING_COHERENCE) + && span_is_local(item.span) && let Some(middle_trait_ref) = cx.tcx.impl_trait_ref(item.owner_id) .map(ty::EarlyBinder::instantiate_identity) && cx.tcx.is_diagnostic_item(sym::Into, middle_trait_ref.def_id) |
