File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments