Skip to content

Commit ce64729

Browse files
committed
Remove methods under Implementors on trait pages
These were hidden by default, and duplicated information already on the page anyhow. Also remove the "Auto-hide trait implementors of a trait" setting, which is not needed anymore.
1 parent 50a4072 commit ce64729

File tree

3 files changed

+21
-42
lines changed

3 files changed

+21
-42
lines changed

Diff for: src/librustdoc/html/render/mod.rs

+21-17
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,6 @@ fn settings(root_path: &str, suffix: &str, themes: &[StylePath]) -> Result<Strin
490490
("auto-hide-method-docs", "Auto-hide item methods' documentation", false).into(),
491491
("auto-hide-trait-implementations", "Auto-hide trait implementation documentation", false)
492492
.into(),
493-
("auto-collapse-implementors", "Auto-hide implementors of a trait", true).into(),
494493
("go-to-only-result", "Directly go to item in search if there is only one result", false)
495494
.into(),
496495
("line-numbers", "Show line numbers on code examples", false).into(),
@@ -1543,7 +1542,10 @@ fn render_impl(
15431542
}
15441543
}
15451544
if render_mode == RenderMode::Normal {
1546-
let toggled = !impl_items.is_empty() || !default_impl_items.is_empty();
1545+
let on_trait_page = matches!(*parent.kind, clean::ItemKind::TraitItem(_));
1546+
let has_impl_items = !(impl_items.is_empty() && default_impl_items.is_empty());
1547+
let toggled = !on_trait_page && has_impl_items;
1548+
let is_implementing_trait = i.inner_impl().trait_.is_some();
15471549
if toggled {
15481550
close_tags.insert_str(0, "</details>");
15491551
write!(w, "<details class=\"rustdoc-toggle implementors-toggle\" open>");
@@ -1571,21 +1573,23 @@ fn render_impl(
15711573
}
15721574
}
15731575

1574-
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
1575-
let mut ids = cx.id_map.borrow_mut();
1576-
write!(
1577-
w,
1578-
"<div class=\"docblock\">{}</div>",
1579-
Markdown(
1580-
&*dox,
1581-
&i.impl_item.links(cx),
1582-
&mut ids,
1583-
cx.shared.codes,
1584-
cx.shared.edition(),
1585-
&cx.shared.playground
1586-
)
1587-
.into_string()
1588-
);
1576+
if !on_trait_page {
1577+
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
1578+
let mut ids = cx.id_map.borrow_mut();
1579+
write!(
1580+
w,
1581+
"<div class=\"docblock\">{}</div>",
1582+
Markdown(
1583+
&*dox,
1584+
&i.impl_item.links(cx),
1585+
&mut ids,
1586+
cx.shared.codes,
1587+
cx.shared.edition(),
1588+
&cx.shared.playground
1589+
)
1590+
.into_string()
1591+
);
1592+
}
15891593
}
15901594
}
15911595
if !default_impl_items.is_empty() || !impl_items.is_empty() {

Diff for: src/librustdoc/html/static/main.js

-5
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,6 @@ function hideThemeButtonState() {
778778
}
779779

780780
var hideMethodDocs = getSettingValue("auto-hide-method-docs") === "true";
781-
var hideImplementors = getSettingValue("auto-collapse-implementors") !== "false";
782781
var hideImplementations = getSettingValue("auto-hide-trait-implementations") === "true";
783782
var hideLargeItemContents = getSettingValue("auto-hide-large-items") !== "false";
784783

@@ -796,10 +795,6 @@ function hideThemeButtonState() {
796795
setImplementorsTogglesOpen("blanket-implementations-list", false);
797796
}
798797

799-
if (!hideImplementors) {
800-
setImplementorsTogglesOpen("implementors-list", true);
801-
}
802-
803798
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function (e) {
804799
if (!hideLargeItemContents && hasClass(e, "type-contents-toggle")) {
805800
e.open = true;

Diff for: src/test/rustdoc/issue-19055.rs

-20
This file was deleted.

0 commit comments

Comments
 (0)