@@ -426,10 +426,10 @@ impl Rewrite for ast::WherePredicate {
426
426
} ) => {
427
427
let type_str = bounded_ty. rewrite ( context, shape) ?;
428
428
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)
431
431
{
432
- format ! ( "for<{}> {}{}" , lifetime_str , type_str, colon)
432
+ format ! ( "for<{}> {}{}" , binder_str , type_str, colon)
433
433
} else {
434
434
format ! ( "{}{}" , type_str, colon)
435
435
} ;
@@ -657,8 +657,7 @@ impl Rewrite for ast::GenericParam {
657
657
658
658
impl Rewrite for ast:: PolyTraitRef {
659
659
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 )
662
661
{
663
662
// 6 is "for<> ".len()
664
663
let extra_offset = lifetime_str. len ( ) + 6 ;
@@ -881,8 +880,7 @@ fn rewrite_bare_fn(
881
880
882
881
let mut result = String :: with_capacity ( 128 ) ;
883
882
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 ) {
886
884
result. push_str ( "for<" ) ;
887
885
// 6 = "for<> ".len(), 4 = "for<".
888
886
// This doesn't work out so nicely for multiline situation with lots of
@@ -1123,15 +1121,14 @@ pub(crate) fn can_be_overflowed_type(
1123
1121
}
1124
1122
1125
1123
/// Returns `None` if there is no `LifetimeDef` in the given generic parameters.
1126
- pub ( crate ) fn rewrite_lifetime_param (
1124
+ pub ( crate ) fn rewrite_bound_params (
1127
1125
context : & RewriteContext < ' _ > ,
1128
1126
shape : Shape ,
1129
1127
generic_params : & [ ast:: GenericParam ] ,
1130
1128
) -> Option < String > {
1131
1129
let result = generic_params
1132
1130
. iter ( )
1133
- . filter ( |p| matches ! ( p. kind, ast:: GenericParamKind :: Lifetime ) )
1134
- . map ( |lt| lt. rewrite ( context, shape) )
1131
+ . map ( |param| param. rewrite ( context, shape) )
1135
1132
. collect :: < Option < Vec < _ > > > ( ) ?
1136
1133
. join ( ", " ) ;
1137
1134
if result. is_empty ( ) {
0 commit comments