@@ -1066,11 +1066,11 @@ impl<'a> State<'a> {
10661066 self . print_qpath ( path, qself, false ) ?
10671067 }
10681068 ast:: TyKind :: TraitObject ( ref bounds, syntax) => {
1069- let prefix = if syntax == ast:: TraitObjectSyntax :: Dyn { "dyn " } else { "" } ;
1069+ let prefix = if syntax == ast:: TraitObjectSyntax :: Dyn { "dyn" } else { "" } ;
10701070 self . print_bounds ( prefix, & bounds[ ..] ) ?;
10711071 }
10721072 ast:: TyKind :: ImplTrait ( ref bounds) => {
1073- self . print_bounds ( "impl " , & bounds[ ..] ) ?;
1073+ self . print_bounds ( "impl" , & bounds[ ..] ) ?;
10741074 }
10751075 ast:: TyKind :: Array ( ref ty, ref v) => {
10761076 self . s . word ( "[" ) ?;
@@ -1398,7 +1398,8 @@ impl<'a> State<'a> {
13981398 real_bounds. push ( b. clone ( ) ) ;
13991399 }
14001400 }
1401- self . print_bounds ( " = " , & real_bounds[ ..] ) ?;
1401+ self . nbsp ( ) ?;
1402+ self . print_bounds ( "=" , & real_bounds[ ..] ) ?;
14021403 self . print_where_clause ( & generics. where_clause ) ?;
14031404 self . s . word ( ";" ) ?;
14041405 }
@@ -1444,6 +1445,7 @@ impl<'a> State<'a> {
14441445 comma = true ;
14451446 }
14461447 self . s . word ( ">" ) ?;
1448+ self . nbsp ( ) ?;
14471449 }
14481450 Ok ( ( ) )
14491451 }
@@ -2818,30 +2820,29 @@ impl<'a> State<'a> {
28182820 self . s . word ( prefix) ?;
28192821 let mut first = true ;
28202822 for bound in bounds {
2821- self . nbsp ( ) ?;
2823+ if !( first && prefix. is_empty ( ) ) {
2824+ self . nbsp ( ) ?;
2825+ }
28222826 if first {
28232827 first = false ;
28242828 } else {
28252829 self . word_space ( "+" ) ?;
28262830 }
28272831
2828- ( match * bound {
2829- TraitTyParamBound ( ref tref, TraitBoundModifier :: None ) => {
2830- self . print_poly_trait_ref ( tref)
2831- }
2832- TraitTyParamBound ( ref tref, TraitBoundModifier :: Maybe ) => {
2833- self . s . word ( "?" ) ?;
2834- self . print_poly_trait_ref ( tref)
2832+ match bound {
2833+ TraitTyParamBound ( tref, modifier) => {
2834+ if modifier == & TraitBoundModifier :: Maybe {
2835+ self . s . word ( "?" ) ?;
2836+ }
2837+ self . print_poly_trait_ref ( tref) ?;
28352838 }
2836- RegionTyParamBound ( ref lt) => {
2837- self . print_lifetime ( lt)
2839+ RegionTyParamBound ( lt) => {
2840+ self . print_lifetime ( lt) ? ;
28382841 }
2839- } ) ?
2842+ }
28402843 }
2841- Ok ( ( ) )
2842- } else {
2843- Ok ( ( ) )
28442844 }
2845+ Ok ( ( ) )
28452846 }
28462847
28472848 pub fn print_lifetime ( & mut self ,
0 commit comments