Remove unneeded extra whitespace before where clause
This commit is contained in:
parent
7a42ca942c
commit
803e35abf7
2 changed files with 10 additions and 15 deletions
|
@ -349,8 +349,7 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
|
||||||
let where_preds = comma_sep(where_predicates, false);
|
let where_preds = comma_sep(where_predicates, false);
|
||||||
let clause = if f.alternate() {
|
let clause = if f.alternate() {
|
||||||
if ending == Ending::Newline {
|
if ending == Ending::Newline {
|
||||||
// add a space so stripping <br> tags and breaking spaces still renders properly
|
format!(" where{where_preds},")
|
||||||
format!(" where{where_preds}, ")
|
|
||||||
} else {
|
} else {
|
||||||
format!(" where{where_preds}")
|
format!(" where{where_preds}")
|
||||||
}
|
}
|
||||||
|
@ -364,20 +363,16 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
|
||||||
|
|
||||||
if ending == Ending::Newline {
|
if ending == Ending::Newline {
|
||||||
let mut clause = " ".repeat(indent.saturating_sub(1));
|
let mut clause = " ".repeat(indent.saturating_sub(1));
|
||||||
// add a space so stripping <br> tags and breaking spaces still renders properly
|
write!(clause, "<span class=\"where fmt-newline\">where{where_preds},</span>")?;
|
||||||
write!(
|
|
||||||
clause,
|
|
||||||
" <span class=\"where fmt-newline\">where{where_preds}, </span>"
|
|
||||||
)?;
|
|
||||||
clause
|
clause
|
||||||
} else {
|
} else {
|
||||||
// insert a <br> tag after a single space but before multiple spaces at the start
|
// insert a <br> tag after a single space but before multiple spaces at the start
|
||||||
if indent == 0 {
|
if indent == 0 {
|
||||||
format!(" <br><span class=\"where\">where{where_preds}</span>")
|
format!("<br><span class=\"where\">where{where_preds}</span>")
|
||||||
} else {
|
} else {
|
||||||
let mut clause = br_with_padding;
|
let mut clause = br_with_padding;
|
||||||
clause.truncate(clause.len() - 5 * " ".len());
|
clause.truncate(clause.len() - 5 * " ".len());
|
||||||
write!(clause, " <span class=\"where\">where{where_preds}</span>")?;
|
write!(clause, "<span class=\"where\">where{where_preds}</span>")?;
|
||||||
clause
|
clause
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1739,8 +1739,8 @@ pub(crate) fn render_impl_summary(
|
||||||
// in documentation pages for trait with automatic implementations like "Send" and "Sync".
|
// in documentation pages for trait with automatic implementations like "Send" and "Sync".
|
||||||
aliases: &[String],
|
aliases: &[String],
|
||||||
) {
|
) {
|
||||||
let id =
|
let inner_impl = i.inner_impl();
|
||||||
cx.derive_id(get_id_for_impl(&i.inner_impl().for_, i.inner_impl().trait_.as_ref(), cx));
|
let id = cx.derive_id(get_id_for_impl(&inner_impl.for_, inner_impl.trait_.as_ref(), cx));
|
||||||
let aliases = if aliases.is_empty() {
|
let aliases = if aliases.is_empty() {
|
||||||
String::new()
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
|
@ -1752,9 +1752,9 @@ pub(crate) fn render_impl_summary(
|
||||||
write!(w, "<h3 class=\"code-header in-band\">");
|
write!(w, "<h3 class=\"code-header in-band\">");
|
||||||
|
|
||||||
if let Some(use_absolute) = use_absolute {
|
if let Some(use_absolute) = use_absolute {
|
||||||
write!(w, "{}", i.inner_impl().print(use_absolute, cx));
|
write!(w, "{}", inner_impl.print(use_absolute, cx));
|
||||||
if show_def_docs {
|
if show_def_docs {
|
||||||
for it in &i.inner_impl().items {
|
for it in &inner_impl.items {
|
||||||
if let clean::AssocTypeItem(ref tydef, ref _bounds) = *it.kind {
|
if let clean::AssocTypeItem(ref tydef, ref _bounds) = *it.kind {
|
||||||
w.write_str("<span class=\"where fmt-newline\"> ");
|
w.write_str("<span class=\"where fmt-newline\"> ");
|
||||||
assoc_type(
|
assoc_type(
|
||||||
|
@ -1772,11 +1772,11 @@ pub(crate) fn render_impl_summary(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
write!(w, "{}", i.inner_impl().print(false, cx));
|
write!(w, "{}", inner_impl.print(false, cx));
|
||||||
}
|
}
|
||||||
write!(w, "</h3>");
|
write!(w, "</h3>");
|
||||||
|
|
||||||
let is_trait = i.inner_impl().trait_.is_some();
|
let is_trait = inner_impl.trait_.is_some();
|
||||||
if is_trait {
|
if is_trait {
|
||||||
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
|
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
|
||||||
write!(w, "<span class=\"item-info\">{}</span>", portability);
|
write!(w, "<span class=\"item-info\">{}</span>", portability);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue