@@ -1338,7 +1338,7 @@ impl<'a> State<'a> {
1338
1338
if comma {
1339
1339
try!( self . word_space ( "," ) )
1340
1340
}
1341
- try!( self . print_lifetime_def ( lifetime_def) ) ;
1341
+ try!( self . print_lifetime_bounds ( & lifetime_def. lifetime , & lifetime_def . bounds ) ) ;
1342
1342
comma = true ;
1343
1343
}
1344
1344
try!( word ( & mut self . s , ">" ) ) ;
@@ -2749,16 +2749,20 @@ impl<'a> State<'a> {
2749
2749
self . print_name ( lifetime. name )
2750
2750
}
2751
2751
2752
- pub fn print_lifetime_def ( & mut self ,
2753
- lifetime : & ast:: LifetimeDef )
2754
- -> io:: Result < ( ) >
2752
+ pub fn print_lifetime_bounds ( & mut self ,
2753
+ lifetime : & ast:: Lifetime ,
2754
+ bounds : & [ ast:: Lifetime ] )
2755
+ -> io:: Result < ( ) >
2755
2756
{
2756
- try!( self . print_lifetime ( & lifetime. lifetime ) ) ;
2757
- let mut sep = ":" ;
2758
- for v in & lifetime. bounds {
2759
- try!( word ( & mut self . s , sep) ) ;
2760
- try!( self . print_lifetime ( v) ) ;
2761
- sep = "+" ;
2757
+ try!( self . print_lifetime ( lifetime) ) ;
2758
+ if !bounds. is_empty ( ) {
2759
+ try!( word ( & mut self . s , ": " ) ) ;
2760
+ for ( i, bound) in bounds. iter ( ) . enumerate ( ) {
2761
+ if i != 0 {
2762
+ try!( word ( & mut self . s , " + " ) ) ;
2763
+ }
2764
+ try!( self . print_lifetime ( bound) ) ;
2765
+ }
2762
2766
}
2763
2767
Ok ( ( ) )
2764
2768
}
@@ -2781,8 +2785,8 @@ impl<'a> State<'a> {
2781
2785
2782
2786
try!( self . commasep ( Inconsistent , & ints[ ..] , |s, & idx| {
2783
2787
if idx < generics. lifetimes . len ( ) {
2784
- let lifetime = & generics. lifetimes [ idx] ;
2785
- s. print_lifetime_def ( lifetime)
2788
+ let lifetime_def = & generics. lifetimes [ idx] ;
2789
+ s. print_lifetime_bounds ( & lifetime_def . lifetime , & lifetime_def . bounds )
2786
2790
} else {
2787
2791
let idx = idx - generics. lifetimes . len ( ) ;
2788
2792
let param = & generics. ty_params [ idx] ;
@@ -2833,16 +2837,7 @@ impl<'a> State<'a> {
2833
2837
ast:: WherePredicate :: RegionPredicate ( ast:: WhereRegionPredicate { ref lifetime,
2834
2838
ref bounds,
2835
2839
..} ) => {
2836
- try!( self . print_lifetime ( lifetime) ) ;
2837
- try!( word ( & mut self . s , ":" ) ) ;
2838
-
2839
- for ( i, bound) in bounds. iter ( ) . enumerate ( ) {
2840
- try!( self . print_lifetime ( bound) ) ;
2841
-
2842
- if i != 0 {
2843
- try!( word ( & mut self . s , ":" ) ) ;
2844
- }
2845
- }
2840
+ try!( self . print_lifetime_bounds ( lifetime, bounds) ) ;
2846
2841
}
2847
2842
ast:: WherePredicate :: EqPredicate ( ast:: WhereEqPredicate { ref path, ref ty, ..} ) => {
2848
2843
try!( self . print_path ( path, false , 0 ) ) ;
0 commit comments