summary refs log tree commit diff
path: root/src/librustdoc/html/render
diff options
context:
space:
mode:
authorJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-06-03 10:28:43 -0700
committerJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-06-16 22:08:36 -0700
commitce6472987d2cb466345a857cb2efdd06307c5ebf (patch)
tree18dec7d1edb4c45c7d2051c1c3e1998d69b4dd92 /src/librustdoc/html/render
parent50a407200b970d8a48e4e58de37c94df355f5472 (diff)
downloadrust-ce6472987d2cb466345a857cb2efdd06307c5ebf.tar.gz
rust-ce6472987d2cb466345a857cb2efdd06307c5ebf.zip
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.
Diffstat (limited to 'src/librustdoc/html/render')
-rw-r--r--src/librustdoc/html/render/mod.rs38
1 files changed, 21 insertions, 17 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 0efa014b127..4f3acfb8e82 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -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-trait-implementations", "Auto-hide trait implementation documentation", false)
             .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)
             .into(),
         ("line-numbers", "Show line numbers on code examples", false).into(),
@@ -1543,7 +1542,10 @@ fn render_impl(
         }
     }
     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 {
             close_tags.insert_str(0, "</details>");
             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) {
-            let mut ids = cx.id_map.borrow_mut();
-            write!(
-                w,
-                "<div class=\"docblock\">{}</div>",
-                Markdown(
-                    &*dox,
-                    &i.impl_item.links(cx),
-                    &mut ids,
-                    cx.shared.codes,
-                    cx.shared.edition(),
-                    &cx.shared.playground
-                )
-                .into_string()
-            );
+        if !on_trait_page {
+            if let Some(ref dox) = cx.shared.maybe_collapsed_doc_value(&i.impl_item) {
+                let mut ids = cx.id_map.borrow_mut();
+                write!(
+                    w,
+                    "<div class=\"docblock\">{}</div>",
+                    Markdown(
+                        &*dox,
+                        &i.impl_item.links(cx),
+                        &mut ids,
+                        cx.shared.codes,
+                        cx.shared.edition(),
+                        &cx.shared.playground
+                    )
+                    .into_string()
+                );
+            }
         }
     }
     if !default_impl_items.is_empty() || !impl_items.is_empty() {