11use clippy_utils:: diagnostics:: { span_lint_and_help, span_lint_and_sugg} ;
22use clippy_utils:: source:: { snippet, snippet_opt, snippet_with_applicability} ;
3- use clippy_utils:: { SpanlessEq , SpanlessHash } ;
3+ use clippy_utils:: { is_from_proc_macro , SpanlessEq , SpanlessHash } ;
44use core:: hash:: { Hash , Hasher } ;
55use if_chain:: if_chain;
66use itertools:: Itertools ;
@@ -260,10 +260,7 @@ 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, "_" ) ;
264- if let TyKind :: Path ( qpath) = p. bounded_ty. kind;
265- if format!( "{}:" , rustc_hir_pretty:: qpath_to_string( & qpath) ) == format!( "{bounded_ty}:" ) ;
266-
263+ if !is_from_proc_macro( cx, p. bounded_ty) ;
267264 then {
268265 let trait_bounds = v
269266 . iter( )
@@ -272,7 +269,10 @@ impl TraitBounds {
272269 . filter_map( get_trait_info_from_bound)
273270 . map( |( _, _, span) | snippet_with_applicability( cx, span, ".." , & mut applicability) )
274271 . join( " + " ) ;
275- let hint_string = format!( "consider combining the bounds: `{bounded_ty}: {trait_bounds}`" ) ;
272+ let hint_string = format!(
273+ "consider combining the bounds: `{}: {trait_bounds}`" ,
274+ snippet( cx, p. bounded_ty. span, "_" ) ,
275+ ) ;
276276 span_lint_and_help(
277277 cx,
278278 TYPE_REPETITION_IN_BOUNDS ,
0 commit comments