Skip to content

Commit

Permalink
rustdoc: move the space at the end of where clauses
Browse files Browse the repository at this point in the history
...so that we don't indent the next line by one extra space
  • Loading branch information
QuietMisdreavus committed Apr 6, 2017
1 parent ae0e45c commit bfd01b7
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,23 @@ impl<'a> fmt::Display for WhereClause<'a> {
clause.push(',');
}
}

if end_newline {
//add a space so stripping <br> tags and breaking spaces still renders properly
if f.alternate() {
clause.push(' ');
} else {
clause.push_str("&nbsp;");
}
}

if !f.alternate() {
clause.push_str("</span>");
let padding = repeat("&nbsp;").take(indent + 4).collect::<String>();
clause = clause.replace("<br>", &format!("<br>{}", padding));
clause.insert_str(0, &repeat("&nbsp;").take(indent.saturating_sub(1))
.collect::<String>());
if end_newline {
clause.push(' ');
} else {
if !end_newline {
clause.insert_str(0, "<br>");
}
}
Expand Down

0 comments on commit bfd01b7

Please sign in to comment.