diff options
| author | Michael Howell <michael@notriddle.com> | 2022-10-10 11:37:19 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2022-10-10 11:40:15 -0700 |
| commit | b63b02f8728259c3b67d1f6ca7d1845892b86a9e (patch) | |
| tree | 827b691a7c90dd8f2c4203e266ee86610bf6e9b2 /src/librustdoc/html/render | |
| parent | 0265a3e93bf1b89d97cae113ed214954d5c35e22 (diff) | |
| download | rust-b63b02f8728259c3b67d1f6ca7d1845892b86a9e.tar.gz rust-b63b02f8728259c3b67d1f6ca7d1845892b86a9e.zip | |
rustdoc: remove unneeded `<div>` wrapper from sidebar DOM
When this was added, the sidebar had a bit more complex style. It can be removed, now.
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 4bbb322d370..5e4226042ec 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1853,12 +1853,12 @@ fn print_sidebar(cx: &Context<'_>, it: &clean::Item, buffer: &mut Buffer) { buffer.write_str("<div class=\"sidebar-elems\">"); if it.is_crate() { - write!(buffer, "<div class=\"block\"><ul>"); + write!(buffer, "<ul class=\"block\">"); if let Some(ref version) = cx.cache().crate_version { write!(buffer, "<li class=\"version\">Version {}</li>", Escape(version)); } write!(buffer, "<li><a id=\"all-types\" href=\"all.html\">All Items</a></li>"); - buffer.write_str("</ul></div>"); + buffer.write_str("</ul>"); } match *it.kind { @@ -2259,7 +2259,7 @@ fn extract_for_impl_name(item: &clean::Item, cx: &Context<'_>) -> Option<(String } /// Don't call this function directly!!! Use `print_sidebar_title` or `print_sidebar_block` instead! -fn print_sidebar_title_inner(buf: &mut Buffer, id: &str, title: &str) { +fn print_sidebar_title(buf: &mut Buffer, id: &str, title: &str) { write!( buf, "<h3 class=\"sidebar-title\">\ @@ -2269,25 +2269,18 @@ fn print_sidebar_title_inner(buf: &mut Buffer, id: &str, title: &str) { ); } -fn print_sidebar_title(buf: &mut Buffer, id: &str, title: &str) { - buf.push_str("<div class=\"block\">"); - print_sidebar_title_inner(buf, id, title); - buf.push_str("</div>"); -} - fn print_sidebar_block( buf: &mut Buffer, id: &str, title: &str, items: impl Iterator<Item = impl fmt::Display>, ) { - buf.push_str("<div class=\"block\">"); - print_sidebar_title_inner(buf, id, title); - buf.push_str("<ul>"); + print_sidebar_title(buf, id, title); + buf.push_str("<ul class=\"block\">"); for item in items { write!(buf, "<li>{}</li>", item); } - buf.push_str("</ul></div>"); + buf.push_str("</ul>"); } fn sidebar_trait(cx: &Context<'_>, buf: &mut Buffer, it: &clean::Item, t: &clean::Trait) { @@ -2676,9 +2669,7 @@ pub(crate) fn sidebar_module_like(buf: &mut Buffer, item_sections_in_use: FxHash write!( buf, "<section>\ - <div class=\"block\">\ - <ul>{}</ul>\ - </div>\ + <ul class=\"block\">{}</ul>\ </section>", sidebar ); |
