@@ -260,9 +260,9 @@ impl TraitBounds {
260260 SpanlessTy { ty: p. bounded_ty, cx } ,
261261 p. bounds. iter( ) . collect:: <Vec <_>>( )
262262 ) ;
263+ let bounded_ty = snippet( cx, p. bounded_ty. span, "_" ) ;
263264 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) ;
266266
267267 then {
268268 let trait_bounds = v
@@ -272,10 +272,7 @@ impl TraitBounds {
272272 . filter_map( get_trait_info_from_bound)
273273 . map( |( _, _, span) | snippet_with_applicability( cx, span, ".." , & mut applicability) )
274274 . 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) ;
279276 span_lint_and_help(
280277 cx,
281278 TYPE_REPETITION_IN_BOUNDS ,
@@ -345,7 +342,7 @@ fn check_trait_bound_duplication(cx: &LateContext<'_>, gen: &'_ Generics<'_>) {
345342 "this trait bound is already specified in the where clause" ,
346343 None ,
347344 "consider removing this trait bound" ,
348- ) ;
345+ ) ;
349346 }
350347 }
351348 }
0 commit comments