Rollup merge of #95813 - Urgau:rustdoc-where-clause-space, r=GuillaumeGomez
Remove extra space before a where clause Remove extra space before where clause in the generated documentation. The fix is to move the space before the break-line so that it doesn't appear visually but is still here. Removing it completely would create things like this `impl<D> Delta<D>where D: MyTrait` (missing a space before the where) which I don't think we want. Added two regression test, first one test that the `<br>` is after the space and the second check that the `<br>` is before the spaces. Before:  After:  r? ``@GuillaumeGomez``
This commit is contained in:
commit
a0ba15bfab
4 changed files with 19 additions and 1 deletions
|
@ -370,7 +370,8 @@ crate fn print_where_clause<'a, 'tcx: 'a>(
|
|||
clause = clause.replace("<br>", &format!("<br>{}", padding));
|
||||
clause.insert_str(0, &" ".repeat(indent.saturating_sub(1)));
|
||||
if !end_newline {
|
||||
clause.insert_str(0, "<br>");
|
||||
// we insert the <br> after a single space but before multiple spaces at the start
|
||||
clause.insert_str(if indent == 0 { 1 } else { 0 }, "<br>");
|
||||
}
|
||||
}
|
||||
write!(f, "{}", clause)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue