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 @@ -279,7 +279,24 @@ crate fn print_where_clause<'a, 'tcx: 'a>(
279279 clause. push_str ( " <span class=\" where\" >where" ) ;
280280 }
281281 }
282- for ( i, pred) in gens. where_predicates . iter ( ) . enumerate ( ) {
282+
283+ #[ derive( Clone , Copy ) ]
284+ enum Print < ' a > {
285+ Predicate ( & ' a clean:: WherePredicate ) ,
286+ Comma ,
287+ }
288+
289+ for pred in gens. where_predicates . iter ( ) . filter ( |pred| {
290+ !matches ! ( pred, clean:: WherePredicate :: BoundPredicate { bounds, .. } if bounds. is_empty( ) )
291+ } ) . map ( Print :: Predicate ) . intersperse ( Print :: Comma ) {
292+ let pred = match pred {
293+ Print :: Predicate ( pred) => pred,
294+ Print :: Comma => {
295+ clause. push ( ',' ) ;
296+ continue ;
297+ }
298+ } ;
299+
283300 if f. alternate ( ) {
284301 clause. push ( ' ' ) ;
285302 } else {
@@ -338,13 +355,10 @@ crate fn print_where_clause<'a, 'tcx: 'a>(
338355 }
339356 }
340357 }
341-
342- if i < gens. where_predicates . len ( ) - 1 || end_newline {
343- clause. push ( ',' ) ;
344- }
345358 }
346359
347360 if end_newline {
361+ clause. push ( ',' ) ;
348362 // add a space so stripping <br> tags and breaking spaces still renders properly
349363 if f. alternate ( ) {
350364 clause. push ( ' ' ) ;
You can’t perform that action at this time.
0 commit comments