From 8db21e9a9c63496271b5db11af665ada036fac4d Mon Sep 17 00:00:00 2001 From: John Kelly Date: Sun, 30 Apr 2023 14:14:47 +0100 Subject: [PATCH] WIP --- clippy_lints/src/trait_bounds.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clippy_lints/src/trait_bounds.rs b/clippy_lints/src/trait_bounds.rs index 4c70bae75290..2c1c63e808bc 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(),