File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -262,7 +262,24 @@ crate fn print_where_clause<'a, 'tcx: 'a>(
262262 clause. push_str ( " <span class=\" where\" >where" ) ;
263263 }
264264 }
265- for ( i, pred) in gens. where_predicates . iter ( ) . enumerate ( ) {
265+
266+ #[ derive( Clone , Copy ) ]
267+ enum Print < ' a > {
268+ Predicate ( & ' a clean:: WherePredicate ) ,
269+ Comma ,
270+ }
271+
272+ for pred in gens. where_predicates . iter ( ) . filter ( |pred| {
273+ !matches ! ( pred, clean:: WherePredicate :: BoundPredicate { bounds, .. } if bounds. is_empty( ) )
274+ } ) . map ( Print :: Predicate ) . intersperse ( Print :: Comma ) {
275+ let pred = match pred {
276+ Print :: Predicate ( pred) => pred,
277+ Print :: Comma => {
278+ clause. push ( ',' ) ;
279+ continue ;
280+ }
281+ } ;
282+
266283 if f. alternate ( ) {
267284 clause. push ( ' ' ) ;
268285 } else {
@@ -321,13 +338,10 @@ crate fn print_where_clause<'a, 'tcx: 'a>(
321338 }
322339 }
323340 }
324-
325- if i < gens. where_predicates . len ( ) - 1 || end_newline {
326- clause. push ( ',' ) ;
327- }
328341 }
329342
330343 if end_newline {
344+ clause. push ( ',' ) ;
331345 // add a space so stripping <br> tags and breaking spaces still renders properly
332346 if f. alternate ( ) {
333347 clause. push ( ' ' ) ;
You can’t perform that action at this time.
0 commit comments