@@ -260,9 +260,9 @@ impl TraitBounds {
260
260
SpanlessTy { ty: p. bounded_ty, cx } ,
261
261
p. bounds. iter( ) . collect:: <Vec <_>>( )
262
262
) ;
263
+ let bounded_ty = snippet( cx, p. bounded_ty. span, "_" ) ;
263
264
if let TyKind :: Path ( qpath) = p. bounded_ty. kind;
264
- if format!( "{}:" , rustc_hir_pretty:: qpath_to_string( & qpath) )
265
- == format!( "{}:" , snippet( cx, p. bounded_ty. span, "_" ) ) ;
265
+ if format!( "{}:" , rustc_hir_pretty:: qpath_to_string( & qpath) ) == format!( "{}:" , bounded_ty) ;
266
266
267
267
then {
268
268
let trait_bounds = v
@@ -272,10 +272,7 @@ impl TraitBounds {
272
272
. filter_map( get_trait_info_from_bound)
273
273
. map( |( _, _, span) | snippet_with_applicability( cx, span, ".." , & mut applicability) )
274
274
. join( " + " ) ;
275
- let hint_string = format!(
276
- "consider combining the bounds: `{}: {trait_bounds}`" ,
277
- snippet( cx, p. bounded_ty. span, "_" ) ,
278
- ) ;
275
+ let hint_string = format!( "consider combining the bounds: `{}: {trait_bounds}`" , bounded_ty) ;
279
276
span_lint_and_help(
280
277
cx,
281
278
TYPE_REPETITION_IN_BOUNDS ,
@@ -345,7 +342,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
345
342
"this trait bound is already specified in the where clause" ,
346
343
None ,
347
344
"consider removing this trait bound" ,
348
- ) ;
345
+ ) ;
349
346
}
350
347
}
351
348
}
0 commit comments