about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-06-24 08:39:45 +0000
committerbors <bors@rust-lang.org>2022-06-24 08:39:45 +0000
commit1d1ae10876d3eaa5c982dd3daa083b7c2fc363b9 (patch)
treea866ba279143fc0066e6fe520a88f2a9ea7e625b
parent3f47cd1752037bd4c4274f67fde55b4490d298ad (diff)
parent87eded6500f1d1185ac7d0a951fe3aaac3d4dff4 (diff)
downloadrust-1d1ae10876d3eaa5c982dd3daa083b7c2fc363b9.tar.gz
rust-1d1ae10876d3eaa5c982dd3daa083b7c2fc363b9.zip
Auto merge of #9037 - smoelius:fix-extra-unused-lifetimes-fp, r=dswij
Fix `extra_unused_lifetimes` false positive

This PR fixes #9014.

I confirmed the FP on the `crates.io` source as `@JohnTitor` mentioned, and confirmed that the FP is no longer present following this change.

I did not include a test in this PR because I think constructing one would be complicated, and the fix is pretty simple. But please let me know if this is unacceptable.

changelog: fix `extra_unused_lifetimes` FP
-rw-r--r--clippy_lints/src/lifetimes.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs
index 93f5663312f..5c0bd57ac50 100644
--- a/clippy_lints/src/lifetimes.rs
+++ b/clippy_lints/src/lifetimes.rs
@@ -92,7 +92,9 @@ impl<'tcx> LateLintPass<'tcx> for Lifetimes {
         if let ItemKind::Fn(ref sig, generics, id) = item.kind {
             check_fn_inner(cx, sig.decl, Some(id), None, generics, item.span, true);
         } else if let ItemKind::Impl(impl_) = item.kind {
-            report_extra_impl_lifetimes(cx, impl_);
+            if !item.span.from_expansion() {
+                report_extra_impl_lifetimes(cx, impl_);
+            }
         }
     }