Skip to content

Commit 0fb3f3b

Browse files
committed
WIP
1 parent 1eff408 commit 0fb3f3b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

clippy_lints/src/trait_bounds.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
177177
bounds,
178178
..
179179
),
180+
span,
180181
..
181182
},
182183
..
@@ -189,6 +190,12 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
189190

190191
let mut seen_def_ids = FxHashSet::default();
191192

193+
let traits = bounds
194+
.iter()
195+
.filter_map(|b| snippet_opt(cx, b.span))
196+
.collect::<Vec<_>>();
197+
let traits = traits.join(" + ");
198+
192199
for bound in bounds.iter() {
193200
let Some(def_id) = bound.trait_ref.trait_def_id() else { continue; };
194201

@@ -198,10 +205,10 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
198205
span_lint_and_sugg(
199206
cx,
200207
TRAIT_DUPLICATION_IN_BOUNDS,
201-
bound.span,
208+
*span,
202209
"this trait bound is already specified in trait declaration",
203210
"consider removing this trait bound",
204-
"".to_string(),
211+
traits.clone(),
205212
Applicability::MaybeIncorrect,
206213
);
207214
}

0 commit comments

Comments
 (0)