about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-05-13 23:09:24 -0700
committerJacob Hoffman-Andrews <github@hoffman-andrews.com>2021-05-13 23:09:24 -0700
commit73a5c1f944b4da797fb494850ea3b3a0ee955856 (patch)
tree1b00fed1bdde5805fa174c84eb568deee493ec97 /src
parent754d17121d04d02bee634558129110b68fa95b00 (diff)
downloadrust-73a5c1f944b4da797fb494850ea3b3a0ee955856.tar.gz
rust-73a5c1f944b4da797fb494850ea3b3a0ee955856.zip
Toggle-wrap items differently than top-doc.
This makes sure things like trait methods get wrapped at the
`<h3><code>` level rather than at the `.docblock` level. Also it ensures
that only the actual top documentation gets the `.top-doc` class.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render/mod.rs6
-rw-r--r--src/librustdoc/html/render/print_item.rs3
2 files changed, 7 insertions, 2 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 5b54b32e4dd..6de4909e953 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -509,7 +509,11 @@ fn document(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, parent: Option
         info!("Documenting {}", name);
     }
     document_item_info(w, cx, item, parent);
-    document_full_collapsible(w, item, cx);
+    if parent.is_none() {
+        document_full_collapsible(w, item, cx);
+    } else {
+        document_full(w, item, cx);
+    }
 }
 
 /// Render md_text as markdown.
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 20e82cf2caf..67cb47d6fe6 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -578,12 +578,13 @@ fn item_trait(w: &mut Buffer, cx: &Context<'_>, it: &clean::Item, t: &clean::Tra
         info!("Documenting {} on {:?}", name, t.name);
         let item_type = m.type_();
         let id = cx.derive_id(format!("{}.{}", item_type, name));
+        write!(w, "<details class=\"rustdoc-toggle\" open><summary>");
         write!(w, "<h3 id=\"{id}\" class=\"method\"><code>", id = id,);
         render_assoc_item(w, m, AssocItemLink::Anchor(Some(&id)), ItemType::Impl, cx);
         w.write_str("</code>");
         render_stability_since(w, m, t, cx.tcx());
         write_srclink(cx, m, w);
-        w.write_str("</h3>");
+        w.write_str("</h3></summary>");
         document(w, cx, m, Some(t));
     }