@@ -1338,7 +1338,7 @@ impl<'a> State<'a> {
13381338 if comma {
13391339 try!( self . word_space ( "," ) )
13401340 }
1341- try!( self . print_lifetime_def ( lifetime_def) ) ;
1341+ try!( self . print_lifetime_bounds ( & lifetime_def. lifetime , & lifetime_def . bounds ) ) ;
13421342 comma = true ;
13431343 }
13441344 try!( word ( & mut self . s , ">" ) ) ;
@@ -2749,16 +2749,20 @@ impl<'a> State<'a> {
27492749 self . print_name ( lifetime. name )
27502750 }
27512751
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 < ( ) >
27552756 {
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+ }
27622766 }
27632767 Ok ( ( ) )
27642768 }
@@ -2781,8 +2785,8 @@ impl<'a> State<'a> {
27812785
27822786 try!( self . commasep ( Inconsistent , & ints[ ..] , |s, & idx| {
27832787 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 )
27862790 } else {
27872791 let idx = idx - generics. lifetimes . len ( ) ;
27882792 let param = & generics. ty_params [ idx] ;
@@ -2833,16 +2837,7 @@ impl<'a> State<'a> {
28332837 ast:: WherePredicate :: RegionPredicate ( ast:: WhereRegionPredicate { ref lifetime,
28342838 ref bounds,
28352839 ..} ) => {
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) ) ;
28462841 }
28472842 ast:: WherePredicate :: EqPredicate ( ast:: WhereEqPredicate { ref path, ref ty, ..} ) => {
28482843 try!( self . print_path ( path, false , 0 ) ) ;
0 commit comments