about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJohn Kelly <johnharrykelly@gmail.com>2023-04-30 14:14:47 +0100
committerJohn Kelly <johnharrykelly@gmail.com>2023-04-30 14:14:47 +0100
commit8db21e9a9c63496271b5db11af665ada036fac4d (patch)
treefa54eea119ec4242a08b78b3608304c1a17c3d5e
parent0fb3f3b25667c2e9c56a7fd83019cafec7ada1cf (diff)
downloadrust-8db21e9a9c63496271b5db11af665ada036fac4d.tar.gz
rust-8db21e9a9c63496271b5db11af665ada036fac4d.zip
WIP
-rw-r--r--clippy_lints/src/trait_bounds.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/clippy_lints/src/trait_bounds.rs b/clippy_lints/src/trait_bounds.rs
index 4c70bae7529..2c1c63e808b 100644
--- a/clippy_lints/src/trait_bounds.rs
+++ b/clippy_lints/src/trait_bounds.rs
@@ -177,7 +177,6 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
                         bounds,
                         ..
                     ),
-                    span,
                     ..
                 },
                 ..
@@ -188,6 +187,12 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
             return;
         }
 
+        let mut bounds_span = Span::default();
+
+        for bound in bounds.iter() {
+            bounds_span = bounds_span.to(bound.span);
+        }
+
         let mut seen_def_ids = FxHashSet::default();
 
         let traits = bounds
@@ -205,7 +210,7 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
                 span_lint_and_sugg(
                     cx,
                     TRAIT_DUPLICATION_IN_BOUNDS,
-                    *span,
+                    bounds_span,
                     "this trait bound is already specified in trait declaration",
                     "consider removing this trait bound",
                     traits.clone(),