Rollup merge of #118483 - notriddle:notriddle/fmt-newline, r=GuillaumeGomez
rustdoc: `div.where` instead of fmt-newline class This is about equally readable, a lot more terse, and stops special-casing functions and methods. ```console $ du -hs doc-old/ doc-new/ 671M doc-old/ 670M doc-new/ ```
This commit is contained in:
commit
a030add411
19 changed files with 41 additions and 49 deletions
|
|
@ -367,7 +367,7 @@ pub(crate) fn print_where_clause<'a, 'tcx: 'a>(
|
|||
|
||||
if ending == Ending::Newline {
|
||||
let mut clause = " ".repeat(indent.saturating_sub(1));
|
||||
write!(clause, "<span class=\"where fmt-newline\">where{where_preds},</span>")?;
|
||||
write!(clause, "<div class=\"where\">where{where_preds},</div>")?;
|
||||
clause
|
||||
} else {
|
||||
// insert a newline after a single space but before multiple spaces at the start
|
||||
|
|
|
|||
|
|
@ -1441,15 +1441,10 @@ fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) {
|
|||
);
|
||||
}
|
||||
|
||||
//use the "where" class here to make it small
|
||||
write!(
|
||||
&mut out,
|
||||
"<span class=\"where fmt-newline\">{}</span>",
|
||||
impl_.print(false, cx)
|
||||
);
|
||||
write!(&mut out, "<div class=\"where\">{}</div>", impl_.print(false, cx));
|
||||
for it in &impl_.items {
|
||||
if let clean::AssocTypeItem(ref tydef, ref _bounds) = *it.kind {
|
||||
out.push_str("<span class=\"where fmt-newline\"> ");
|
||||
out.push_str("<div class=\"where\"> ");
|
||||
let empty_set = FxHashSet::default();
|
||||
let src_link = AssocItemLink::GotoSource(trait_did.into(), &empty_set);
|
||||
assoc_type(
|
||||
|
|
@ -1462,7 +1457,7 @@ fn notable_traits_decl(ty: &clean::Type, cx: &Context<'_>) -> (String, String) {
|
|||
0,
|
||||
cx,
|
||||
);
|
||||
out.push_str(";</span>");
|
||||
out.push_str(";</div>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1948,7 +1943,7 @@ pub(crate) fn render_impl_summary(
|
|||
if show_def_docs {
|
||||
for it in &inner_impl.items {
|
||||
if let clean::AssocTypeItem(ref tydef, ref _bounds) = *it.kind {
|
||||
w.write_str("<span class=\"where fmt-newline\"> ");
|
||||
w.write_str("<div class=\"where\"> ");
|
||||
assoc_type(
|
||||
w,
|
||||
it,
|
||||
|
|
@ -1959,7 +1954,7 @@ pub(crate) fn render_impl_summary(
|
|||
0,
|
||||
cx,
|
||||
);
|
||||
w.write_str(";</span>");
|
||||
w.write_str(";</div>");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -703,11 +703,8 @@ pre, .rustdoc.src .example-wrap {
|
|||
background: var(--table-alt-row-background-color);
|
||||
}
|
||||
|
||||
/* Shift "where ..." part of method or fn definition down a line */
|
||||
.method .where,
|
||||
.fn .where,
|
||||
.where.fmt-newline {
|
||||
display: block;
|
||||
/* "where ..." clauses with block display are also smaller */
|
||||
div.where {
|
||||
white-space: pre-wrap;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue