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.
This commit is contained in:
parent
50a407200b
commit
ce6472987d
3 changed files with 21 additions and 42 deletions
|
@ -490,7 +490,6 @@ fn settings(root_path: &str, suffix: &str, themes: &[StylePath]) -> Result<Strin
|
||||||
("auto-hide-method-docs", "Auto-hide item methods' documentation", false).into(),
|
("auto-hide-method-docs", "Auto-hide item methods' documentation", false).into(),
|
||||||
("auto-hide-trait-implementations", "Auto-hide trait implementation documentation", false)
|
("auto-hide-trait-implementations", "Auto-hide trait implementation documentation", false)
|
||||||
.into(),
|
.into(),
|
||||||
("auto-collapse-implementors", "Auto-hide implementors of a trait", true).into(),
|
|
||||||
("go-to-only-result", "Directly go to item in search if there is only one result", false)
|
("go-to-only-result", "Directly go to item in search if there is only one result", false)
|
||||||
.into(),
|
.into(),
|
||||||
("line-numbers", "Show line numbers on code examples", false).into(),
|
("line-numbers", "Show line numbers on code examples", false).into(),
|
||||||
|
@ -1543,7 +1542,10 @@ fn render_impl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if render_mode == RenderMode::Normal {
|
if render_mode == RenderMode::Normal {
|
||||||
let toggled = !impl_items.is_empty() || !default_impl_items.is_empty();
|
let on_trait_page = matches!(*parent.kind, clean::ItemKind::TraitItem(_));
|
||||||
|
let has_impl_items = !(impl_items.is_empty() && default_impl_items.is_empty());
|
||||||
|
let toggled = !on_trait_page && has_impl_items;
|
||||||
|
let is_implementing_trait = i.inner_impl().trait_.is_some();
|
||||||
if toggled {
|
if toggled {
|
||||||
close_tags.insert_str(0, "</details>");
|
close_tags.insert_str(0, "</details>");
|
||||||
write!(w, "<details class=\"rustdoc-toggle implementors-toggle\" open>");
|
write!(w, "<details class=\"rustdoc-toggle implementors-toggle\" open>");
|
||||||
|
@ -1571,21 +1573,23 @@ fn render_impl(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
|
if !on_trait_page {
|
||||||
let mut ids = cx.id_map.borrow_mut();
|
if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
|
||||||
write!(
|
let mut ids = cx.id_map.borrow_mut();
|
||||||
w,
|
write!(
|
||||||
"<div class=\"docblock\">{}</div>",
|
w,
|
||||||
Markdown(
|
"<div class=\"docblock\">{}</div>",
|
||||||
&*dox,
|
Markdown(
|
||||||
&i.impl_item.links(cx),
|
&*dox,
|
||||||
&mut ids,
|
&i.impl_item.links(cx),
|
||||||
cx.shared.codes,
|
&mut ids,
|
||||||
cx.shared.edition(),
|
cx.shared.codes,
|
||||||
&cx.shared.playground
|
cx.shared.edition(),
|
||||||
)
|
&cx.shared.playground
|
||||||
.into_string()
|
)
|
||||||
);
|
.into_string()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !default_impl_items.is_empty() || !impl_items.is_empty() {
|
if !default_impl_items.is_empty() || !impl_items.is_empty() {
|
||||||
|
|
|
@ -778,7 +778,6 @@ function hideThemeButtonState() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var hideMethodDocs = getSettingValue("auto-hide-method-docs") === "true";
|
var hideMethodDocs = getSettingValue("auto-hide-method-docs") === "true";
|
||||||
var hideImplementors = getSettingValue("auto-collapse-implementors") !== "false";
|
|
||||||
var hideImplementations = getSettingValue("auto-hide-trait-implementations") === "true";
|
var hideImplementations = getSettingValue("auto-hide-trait-implementations") === "true";
|
||||||
var hideLargeItemContents = getSettingValue("auto-hide-large-items") !== "false";
|
var hideLargeItemContents = getSettingValue("auto-hide-large-items") !== "false";
|
||||||
|
|
||||||
|
@ -796,10 +795,6 @@ function hideThemeButtonState() {
|
||||||
setImplementorsTogglesOpen("blanket-implementations-list", false);
|
setImplementorsTogglesOpen("blanket-implementations-list", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hideImplementors) {
|
|
||||||
setImplementorsTogglesOpen("implementors-list", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function (e) {
|
onEachLazy(document.getElementsByClassName("rustdoc-toggle"), function (e) {
|
||||||
if (!hideLargeItemContents && hasClass(e, "type-contents-toggle")) {
|
if (!hideLargeItemContents && hasClass(e, "type-contents-toggle")) {
|
||||||
e.open = true;
|
e.open = true;
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
// @has issue_19055/trait.Any.html
|
|
||||||
pub trait Any {}
|
|
||||||
|
|
||||||
impl<'any> Any + 'any {
|
|
||||||
// @has - '//*[@id="method.is"]' 'fn is'
|
|
||||||
pub fn is<T: 'static>(&self) -> bool { loop {} }
|
|
||||||
|
|
||||||
// @has - '//*[@id="method.downcast_ref"]' 'fn downcast_ref'
|
|
||||||
pub fn downcast_ref<T: 'static>(&self) -> Option<&T> { loop {} }
|
|
||||||
|
|
||||||
// @has - '//*[@id="method.downcast_mut"]' 'fn downcast_mut'
|
|
||||||
pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> { loop {} }
|
|
||||||
}
|
|
||||||
|
|
||||||
pub trait Foo {
|
|
||||||
fn foo(&self) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
// @has - '//*[@id="method.foo"]' 'fn foo'
|
|
||||||
impl Foo for Any {}
|
|
Loading…
Add table
Add a link
Reference in a new issue