Skip to content

Commit

Permalink
Do not display hidden ~const Drop bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
fee1-dead committed Feb 21, 2022
1 parent d2eccb0 commit 5406cbf
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/librustdoc/html/format.rs
Expand Up @@ -279,7 +279,24 @@ crate fn print_where_clause<'a, 'tcx: 'a>(
clause.push_str(" <span class=\"where\">where");
}
}
for (i, pred) in gens.where_predicates.iter().enumerate() {

#[derive(Clone, Copy)]
enum Print<'a> {
Predicate(&'a clean::WherePredicate),
Comma,
}

for pred in gens.where_predicates.iter().filter(|pred| {
!matches!(pred, clean::WherePredicate::BoundPredicate { bounds, .. } if bounds.is_empty())
}).map(Print::Predicate).intersperse(Print::Comma) {
let pred = match pred {
Print::Predicate(pred) => pred,
Print::Comma => {
clause.push(',');
continue;
}
};

if f.alternate() {
clause.push(' ');
} else {
Expand Down Expand Up @@ -338,13 +355,10 @@ crate fn print_where_clause<'a, 'tcx: 'a>(
}
}
}

if i < gens.where_predicates.len() - 1 || end_newline {
clause.push(',');
}
}

if end_newline {
clause.push(',');
// add a space so stripping <br> tags and breaking spaces still renders properly
if f.alternate() {
clause.push(' ');
Expand Down

0 comments on commit 5406cbf

Please sign in to comment.