Skip to content

Commit 803e35a

Browse files
Remove unneeded extra whitespace before where clause
1 parent 7a42ca9 commit 803e35a

File tree

2 files changed

+10
-15
lines changed

2 files changed

+10
-15
lines changed

src/librustdoc/html/format.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
349349
let where_preds = comma_sep(where_predicates, false);
350350
let clause = if f.alternate() {
351351
if ending == Ending::Newline {
352-
// add a space so stripping <br> tags and breaking spaces still renders properly
353-
format!(" where{where_preds}, ")
352+
format!(" where{where_preds},")
354353
} else {
355354
format!(" where{where_preds}")
356355
}
@@ -364,20 +363,16 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
364363

365364
if ending == Ending::Newline {
366365
let mut clause = "&nbsp;".repeat(indent.saturating_sub(1));
367-
// add a space so stripping <br> tags and breaking spaces still renders properly
368-
write!(
369-
clause,
370-
" <span class=\"where fmt-newline\">where{where_preds},&nbsp;</span>"
371-
)?;
366+
write!(clause, "<span class=\"where fmt-newline\">where{where_preds},</span>")?;
372367
clause
373368
} else {
374369
// insert a <br> tag after a single space but before multiple spaces at the start
375370
if indent == 0 {
376-
format!(" <br><span class=\"where\">where{where_preds}</span>")
371+
format!("<br><span class=\"where\">where{where_preds}</span>")
377372
} else {
378373
let mut clause = br_with_padding;
379374
clause.truncate(clause.len() - 5 * "&nbsp;".len());
380-
write!(clause, " <span class=\"where\">where{where_preds}</span>")?;
375+
write!(clause, "<span class=\"where\">where{where_preds}</span>")?;
381376
clause
382377
}
383378
}

src/librustdoc/html/render/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,8 +1739,8 @@ pub(crate) fn render_impl_summary(
17391739
// in documentation pages for trait with automatic implementations like "Send" and "Sync".
17401740
aliases: &[String],
17411741
) {
1742-
let id =
1743-
cx.derive_id(get_id_for_impl(&i.inner_impl().for_, i.inner_impl().trait_.as_ref(), cx));
1742+
let inner_impl = i.inner_impl();
1743+
let id = cx.derive_id(get_id_for_impl(&inner_impl.for_, inner_impl.trait_.as_ref(), cx));
17441744
let aliases = if aliases.is_empty() {
17451745
String::new()
17461746
} else {
@@ -1752,9 +1752,9 @@ pub(crate) fn render_impl_summary(
17521752
write!(w, "<h3 class=\"code-header in-band\">");
17531753

17541754
if let Some(use_absolute) = use_absolute {
1755-
write!(w, "{}", i.inner_impl().print(use_absolute, cx));
1755+
write!(w, "{}", inner_impl.print(use_absolute, cx));
17561756
if show_def_docs {
1757-
for it in &i.inner_impl().items {
1757+
for it in &inner_impl.items {
17581758
if let clean::AssocTypeItem(ref tydef, ref _bounds) = *it.kind {
17591759
w.write_str("<span class=\"where fmt-newline\"> ");
17601760
assoc_type(
@@ -1772,11 +1772,11 @@ pub(crate) fn render_impl_summary(
17721772
}
17731773
}
17741774
} else {
1775-
write!(w, "{}", i.inner_impl().print(false, cx));
1775+
write!(w, "{}", inner_impl.print(false, cx));
17761776
}
17771777
write!(w, "</h3>");
17781778

1779-
let is_trait = i.inner_impl().trait_.is_some();
1779+
let is_trait = inner_impl.trait_.is_some();
17801780
if is_trait {
17811781
if let Some(portability) = portability(&i.impl_item, Some(parent)) {
17821782
write!(w, "<span class=\"item-info\">{}</span>", portability);

0 commit comments

Comments
 (0)