@@ -1066,11 +1066,11 @@ impl<'a> State<'a> {
1066
1066
self . print_qpath ( path, qself, false ) ?
1067
1067
}
1068
1068
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 { "" } ;
1070
1070
self . print_bounds ( prefix, & bounds[ ..] ) ?;
1071
1071
}
1072
1072
ast:: TyKind :: ImplTrait ( ref bounds) => {
1073
- self . print_bounds ( "impl " , & bounds[ ..] ) ?;
1073
+ self . print_bounds ( "impl" , & bounds[ ..] ) ?;
1074
1074
}
1075
1075
ast:: TyKind :: Array ( ref ty, ref v) => {
1076
1076
self . s . word ( "[" ) ?;
@@ -1398,7 +1398,8 @@ impl<'a> State<'a> {
1398
1398
real_bounds. push ( b. clone ( ) ) ;
1399
1399
}
1400
1400
}
1401
- self . print_bounds ( " = " , & real_bounds[ ..] ) ?;
1401
+ self . nbsp ( ) ?;
1402
+ self . print_bounds ( "=" , & real_bounds[ ..] ) ?;
1402
1403
self . print_where_clause ( & generics. where_clause ) ?;
1403
1404
self . s . word ( ";" ) ?;
1404
1405
}
@@ -1444,6 +1445,7 @@ impl<'a> State<'a> {
1444
1445
comma = true ;
1445
1446
}
1446
1447
self . s . word ( ">" ) ?;
1448
+ self . nbsp ( ) ?;
1447
1449
}
1448
1450
Ok ( ( ) )
1449
1451
}
@@ -2818,30 +2820,29 @@ impl<'a> State<'a> {
2818
2820
self . s . word ( prefix) ?;
2819
2821
let mut first = true ;
2820
2822
for bound in bounds {
2821
- self . nbsp ( ) ?;
2823
+ if !( first && prefix. is_empty ( ) ) {
2824
+ self . nbsp ( ) ?;
2825
+ }
2822
2826
if first {
2823
2827
first = false ;
2824
2828
} else {
2825
2829
self . word_space ( "+" ) ?;
2826
2830
}
2827
2831
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) ?;
2835
2838
}
2836
- RegionTyParamBound ( ref lt) => {
2837
- self . print_lifetime ( lt)
2839
+ RegionTyParamBound ( lt) => {
2840
+ self . print_lifetime ( lt) ? ;
2838
2841
}
2839
- } ) ?
2842
+ }
2840
2843
}
2841
- Ok ( ( ) )
2842
- } else {
2843
- Ok ( ( ) )
2844
2844
}
2845
+ Ok ( ( ) )
2845
2846
}
2846
2847
2847
2848
pub fn print_lifetime ( & mut self ,
0 commit comments