From b3865d1832ff1e08e159f327b3b26d73f079f7b3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 17 Jan 2025 21:41:51 +0100 Subject: Remove more CSS classes --- src/librustdoc/html/render/print_item.rs | 25 ++++++++----------------- src/librustdoc/html/static/css/rustdoc.css | 22 +++++++++++----------- 2 files changed, 19 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index e7700d85344..76a51cc64a8 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -412,14 +412,14 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl match *src { Some(src) => write!( w, - "
{}extern crate {} as {};", + "
{}extern crate {} as {};", visibility_print_with_space(myitem, cx), anchor(myitem.item_id.expect_def_id(), src, cx), EscapeBodyTextWithWbr(myitem.name.unwrap().as_str()), ), None => write!( w, - "
{}extern crate {};", + "
{}extern crate {};", visibility_print_with_space(myitem, cx), anchor(myitem.item_id.expect_def_id(), myitem.name.unwrap(), cx), ), @@ -438,17 +438,11 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl } clean::ImportKind::Glob => String::new(), }; - let (stab_tags_before, stab_tags_after) = if stab_tags.is_empty() { - ("", "") - } else { - ("
", "
") - }; write!( w, - "
\ - {vis}{imp}\ -
\ - {stab_tags_before}{stab_tags}{stab_tags_after}", + "\ + {vis}{imp}{stab_tags}\ + ", vis = visibility_print_with_space(myitem, cx), imp = import.print(cx), ); @@ -486,14 +480,11 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl let docs = MarkdownSummaryLine(&myitem.doc_value(), &myitem.links(cx)).into_string(); - let (docs_before, docs_after) = if docs.is_empty() { - ("", "") - } else { - ("
", "
") - }; + let (docs_before, docs_after) = + if docs.is_empty() { ("", "") } else { ("
", "
") }; write!( w, - "
\ + "
\ {name}\ {visibility_and_hidden}\ {unsafety_flag}\ diff --git a/src/librustdoc/html/static/css/rustdoc.css b/src/librustdoc/html/static/css/rustdoc.css index f47df5bbcea..4cb05b05be5 100644 --- a/src/librustdoc/html/static/css/rustdoc.css +++ b/src/librustdoc/html/static/css/rustdoc.css @@ -242,7 +242,7 @@ h1, h2, h3, h4, h5, h6, .mobile-topbar, .search-input, .search-results .result-name, -.item-name > a, +.item-table dt > a, .out-of-band, .sub-heading, span.since, @@ -385,11 +385,11 @@ details:not(.toggle) summary { code, pre, .code-header, .type-signature { font-family: "Source Code Pro", monospace; } -.docblock code, .docblock-short code { +.docblock code, .item-table dd code { border-radius: 3px; padding: 0 0.125em; } -.docblock pre code, .docblock-short pre code { +.docblock pre code, .item-table dd pre code { padding: 0; } pre { @@ -887,13 +887,13 @@ both the code example and the line numbers, so we need to remove the radius in t text-align: center; } -.docblock-short { +.item-table dd { overflow-wrap: break-word; overflow-wrap: anywhere; } /* Wrap non-pre code blocks (`text`) but not (```text```). */ .docblock :not(pre) > code, -.docblock-short code { +.item-table dd code { white-space: pre-wrap; } @@ -938,7 +938,7 @@ rustdoc-toolbar { min-height: 60px; } -.docblock code, .docblock-short code, +.docblock code, .item-table dd code, pre, .rustdoc.src .example-wrap, .example-wrap .src-line-numbers { background-color: var(--code-block-background-color); border-radius: var(--code-block-border-radius); @@ -964,7 +964,7 @@ pre, .rustdoc.src .example-wrap, .example-wrap .src-line-numbers { background: var(--table-alt-row-background-color); } -.docblock .stab, .docblock-short .stab, .docblock p code { +.docblock .stab, .item-table dd .stab, .docblock p code { display: inline-block; } @@ -1069,7 +1069,7 @@ because of the `[-]` element which would overlap with it. */ .example-wrap .rust a:hover, .all-items a:hover, .docblock a:not(.scrape-help):not(.tooltip):hover:not(.doc-anchor), -.docblock-short a:not(.scrape-help):not(.tooltip):hover, +.item-table dd a:not(.scrape-help):not(.tooltip):hover, .item-info a { text-decoration: underline; } @@ -1106,7 +1106,7 @@ table, margin: 0; width: 100%; } -.item-table > .item-name { +.item-table > dt { padding-right: 1.25rem; } .item-table > dd { @@ -1412,7 +1412,7 @@ so that we can apply CSS-filters to change the arrow color in themes */ padding: 3px; margin-bottom: 5px; } -.item-name .stab { +.item-table dt .stab { margin-left: 0.3125em; } .stab { @@ -2481,7 +2481,7 @@ in src-script.js and main.js .search-results > a { padding: 5px 0px; } - .search-results > a > div.desc, .item-table dd.desc { + .search-results > a > div.desc, .item-table dd { padding-left: 2em; } .search-results .result-name { -- cgit 1.4.1-3-g733a5