@@ -367,6 +367,10 @@ pub fn generics_to_string(generics: &ast::Generics) -> String {
367
367
$to_string( |s| s. print_generics( generics) )
368
368
}
369
369
370
+ pub fn where_clause_to_string( i: & ast:: WhereClause ) -> String {
371
+ $to_string( |s| s. print_where_clause( i) )
372
+ }
373
+
370
374
pub fn fn_block_to_string( p: & ast:: FnDecl ) -> String {
371
375
$to_string( |s| s. print_fn_block_args( p) )
372
376
}
@@ -912,7 +916,7 @@ impl<'a> State<'a> {
912
916
try!( space ( & mut self . s ) ) ;
913
917
try!( self . word_space ( "=" ) ) ;
914
918
try!( self . print_type ( & * * ty) ) ;
915
- try!( self . print_where_clause ( params) ) ;
919
+ try!( self . print_where_clause ( & params. where_clause ) ) ;
916
920
try!( word ( & mut self . s , ";" ) ) ;
917
921
try!( self . end ( ) ) ; // end the outer ibox
918
922
}
@@ -975,7 +979,7 @@ impl<'a> State<'a> {
975
979
}
976
980
977
981
try!( self . print_type ( & * * ty) ) ;
978
- try!( self . print_where_clause ( generics) ) ;
982
+ try!( self . print_where_clause ( & generics. where_clause ) ) ;
979
983
980
984
try!( space ( & mut self . s ) ) ;
981
985
try!( self . bopen ( ) ) ;
@@ -1003,7 +1007,7 @@ impl<'a> State<'a> {
1003
1007
}
1004
1008
}
1005
1009
try!( self . print_bounds ( ":" , & real_bounds[ ..] ) ) ;
1006
- try!( self . print_where_clause ( generics) ) ;
1010
+ try!( self . print_where_clause ( & generics. where_clause ) ) ;
1007
1011
try!( word ( & mut self . s , " " ) ) ;
1008
1012
try!( self . bopen ( ) ) ;
1009
1013
for trait_item in trait_items {
@@ -1061,7 +1065,7 @@ impl<'a> State<'a> {
1061
1065
try!( self . head ( & visibility_qualified ( visibility, "enum" ) ) ) ;
1062
1066
try!( self . print_ident ( ident) ) ;
1063
1067
try!( self . print_generics ( generics) ) ;
1064
- try!( self . print_where_clause ( generics) ) ;
1068
+ try!( self . print_where_clause ( & generics. where_clause ) ) ;
1065
1069
try!( space ( & mut self . s ) ) ;
1066
1070
self . print_variants ( & enum_definition. variants , span)
1067
1071
}
@@ -1115,12 +1119,12 @@ impl<'a> State<'a> {
1115
1119
) ) ;
1116
1120
try!( self . pclose ( ) ) ;
1117
1121
}
1118
- try!( self . print_where_clause ( generics) ) ;
1122
+ try!( self . print_where_clause ( & generics. where_clause ) ) ;
1119
1123
try!( word ( & mut self . s , ";" ) ) ;
1120
1124
try!( self . end ( ) ) ;
1121
1125
self . end ( ) // close the outer-box
1122
1126
} else {
1123
- try!( self . print_where_clause ( generics) ) ;
1127
+ try!( self . print_where_clause ( & generics. where_clause ) ) ;
1124
1128
try!( self . nbsp ( ) ) ;
1125
1129
try!( self . bopen ( ) ) ;
1126
1130
try!( self . hardbreak_if_not_bol ( ) ) ;
@@ -2343,7 +2347,7 @@ impl<'a> State<'a> {
2343
2347
}
2344
2348
try!( self . print_generics ( generics) ) ;
2345
2349
try!( self . print_fn_args_and_ret ( decl, opt_explicit_self) ) ;
2346
- self . print_where_clause ( generics)
2350
+ self . print_where_clause ( & generics. where_clause )
2347
2351
}
2348
2352
2349
2353
pub fn print_fn_args ( & mut self , decl : & ast:: FnDecl ,
@@ -2526,19 +2530,16 @@ impl<'a> State<'a> {
2526
2530
}
2527
2531
}
2528
2532
2529
- pub fn print_where_clause ( & mut self , generics : & ast:: Generics )
2533
+ pub fn print_where_clause ( & mut self , where_clause : & ast:: WhereClause )
2530
2534
-> io:: Result < ( ) > {
2531
- if generics . where_clause . predicates . len ( ) == 0 {
2535
+ if where_clause. predicates . len ( ) == 0 {
2532
2536
return Ok ( ( ) )
2533
2537
}
2534
2538
2535
2539
try!( space ( & mut self . s ) ) ;
2536
2540
try!( self . word_space ( "where" ) ) ;
2537
2541
2538
- for ( i, predicate) in generics. where_clause
2539
- . predicates
2540
- . iter ( )
2541
- . enumerate ( ) {
2542
+ for ( i, predicate) in where_clause. predicates . iter ( ) . enumerate ( ) {
2542
2543
if i != 0 {
2543
2544
try!( self . word_space ( "," ) ) ;
2544
2545
}
0 commit comments