@@ -426,10 +426,10 @@ impl Rewrite for ast::WherePredicate {
426426 } ) => {
427427 let type_str = bounded_ty. rewrite ( context, shape) ?;
428428 let colon = type_bound_colon ( context) . trim_end ( ) ;
429- let lhs = if let Some ( lifetime_str ) =
430- rewrite_lifetime_param ( context, shape, bound_generic_params)
429+ let lhs = if let Some ( binder_str ) =
430+ rewrite_bound_params ( context, shape, bound_generic_params)
431431 {
432- format ! ( "for<{}> {}{}" , lifetime_str , type_str, colon)
432+ format ! ( "for<{}> {}{}" , binder_str , type_str, colon)
433433 } else {
434434 format ! ( "{}{}" , type_str, colon)
435435 } ;
@@ -657,8 +657,7 @@ impl Rewrite for ast::GenericParam {
657657
658658impl Rewrite for ast:: PolyTraitRef {
659659 fn rewrite ( & self , context : & RewriteContext < ' _ > , shape : Shape ) -> Option < String > {
660- if let Some ( lifetime_str) =
661- rewrite_lifetime_param ( context, shape, & self . bound_generic_params )
660+ if let Some ( lifetime_str) = rewrite_bound_params ( context, shape, & self . bound_generic_params )
662661 {
663662 // 6 is "for<> ".len()
664663 let extra_offset = lifetime_str. len ( ) + 6 ;
@@ -881,8 +880,7 @@ fn rewrite_bare_fn(
881880
882881 let mut result = String :: with_capacity ( 128 ) ;
883882
884- if let Some ( ref lifetime_str) = rewrite_lifetime_param ( context, shape, & bare_fn. generic_params )
885- {
883+ if let Some ( ref lifetime_str) = rewrite_bound_params ( context, shape, & bare_fn. generic_params ) {
886884 result. push_str ( "for<" ) ;
887885 // 6 = "for<> ".len(), 4 = "for<".
888886 // This doesn't work out so nicely for multiline situation with lots of
@@ -1122,16 +1120,15 @@ pub(crate) fn can_be_overflowed_type(
11221120 }
11231121}
11241122
1125- /// Returns `None` if there is no `LifetimeDef ` in the given generic parameters.
1126- pub ( crate ) fn rewrite_lifetime_param (
1123+ /// Returns `None` if there is no `GenericParam ` in the list
1124+ pub ( crate ) fn rewrite_bound_params (
11271125 context : & RewriteContext < ' _ > ,
11281126 shape : Shape ,
11291127 generic_params : & [ ast:: GenericParam ] ,
11301128) -> Option < String > {
11311129 let result = generic_params
11321130 . iter ( )
1133- . filter ( |p| matches ! ( p. kind, ast:: GenericParamKind :: Lifetime ) )
1134- . map ( |lt| lt. rewrite ( context, shape) )
1131+ . map ( |param| param. rewrite ( context, shape) )
11351132 . collect :: < Option < Vec < _ > > > ( ) ?
11361133 . join ( ", " ) ;
11371134 if result. is_empty ( ) {
0 commit comments