@@ -18,8 +18,8 @@ use syntax::symbol::keywords;
18
18
19
19
use codemap:: SpanUtils ;
20
20
use config:: { IndentStyle , TypeDensity } ;
21
- use expr:: { rewrite_assign_rhs, rewrite_pair, rewrite_tuple, rewrite_unary_prefix,
22
- PairParts , ToExpr } ;
21
+ use expr:: { rewrite_assign_rhs, rewrite_pair, rewrite_tuple, rewrite_unary_prefix, PairParts ,
22
+ ToExpr } ;
23
23
use lists:: { definitive_tactic, itemize_list, write_list, ListFormatting , Separator } ;
24
24
use macros:: { rewrite_macro, MacroPosition } ;
25
25
use overflow;
@@ -485,17 +485,13 @@ fn rewrite_bounded_lifetime(
485
485
if bounds. len ( ) == 0 {
486
486
Some ( result)
487
487
} else {
488
- let appendix = bounds
489
- . iter ( )
490
- . map ( |b| b. rewrite ( context, shape) )
491
- . collect :: < Option < Vec < _ > > > ( ) ?;
492
488
let colon = type_bound_colon ( context) ;
493
489
let overhead = last_line_width ( & result) + colon. len ( ) ;
494
490
let result = format ! (
495
491
"{}{}{}" ,
496
492
result,
497
493
colon,
498
- join_bounds( context, shape. sub_width( overhead) ?, bounds, & appendix , true ) ?
494
+ join_bounds( context, shape. sub_width( overhead) ?, bounds, true ) ?
499
495
) ;
500
496
Some ( result)
501
497
}
@@ -529,20 +525,13 @@ pub struct TraitTyParamBounds<'a> {
529
525
530
526
impl < ' a > Rewrite for TraitTyParamBounds < ' a > {
531
527
fn rewrite ( & self , context : & RewriteContext , shape : Shape ) -> Option < String > {
532
- let strs = self . inner
533
- . iter ( )
534
- . map ( |b| b. rewrite ( context, shape) )
535
- . collect :: < Option < Vec < _ > > > ( ) ?;
536
- join_bounds ( context, shape, self . inner , & strs, false )
528
+ join_bounds ( context, shape, self . inner , false )
537
529
}
538
530
}
539
531
540
532
impl Rewrite for ast:: TyParamBounds {
541
533
fn rewrite ( & self , context : & RewriteContext , shape : Shape ) -> Option < String > {
542
- let strs = self . iter ( )
543
- . map ( |b| b. rewrite ( context, shape) )
544
- . collect :: < Option < Vec < _ > > > ( ) ?;
545
- join_bounds ( context, shape, self , & strs, true )
534
+ join_bounds ( context, shape, self , true )
546
535
}
547
536
}
548
537
@@ -779,7 +768,6 @@ fn join_bounds<T>(
779
768
context : & RewriteContext ,
780
769
shape : Shape ,
781
770
items : & [ T ] ,
782
- type_strs : & [ String ] ,
783
771
need_indent : bool ,
784
772
) -> Option < String >
785
773
where
@@ -790,6 +778,10 @@ where
790
778
TypeDensity :: Compressed => "+" ,
791
779
TypeDensity :: Wide => " + " ,
792
780
} ;
781
+ let type_strs = items
782
+ . iter ( )
783
+ . map ( |item| item. rewrite ( context, shape) )
784
+ . collect :: < Option < Vec < _ > > > ( ) ?;
793
785
let result = type_strs. join ( joiner) ;
794
786
if items. len ( ) == 1 || ( !result. contains ( '\n' ) && result. len ( ) <= shape. width ) {
795
787
return Some ( result) ;
@@ -805,7 +797,7 @@ where
805
797
. collect :: < Option < Vec < _ > > > ( ) ?;
806
798
( type_strs, nested_shape. indent )
807
799
} else {
808
- ( type_strs. to_vec ( ) , shape. indent )
800
+ ( type_strs, shape. indent )
809
801
} ;
810
802
811
803
let joiner = format ! ( "{}+ " , offset. to_string_with_newline( context. config) ) ;
0 commit comments