about summary refs log tree commit diff
path: root/src/librustdoc/html
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-04-27 01:58:29 +0000
committerbors <bors@rust-lang.org>2021-04-27 01:58:29 +0000
commit6eb956fcbb040d9d4276d97944b5c6df2f84ede8 (patch)
tree26cda2f2f8e17722c2612c96787d7328fe130a85 /src/librustdoc/html
parent61e171566a9c97ec41656e96e4dd23261b812b9d (diff)
parent6c8969c43ce37d22b0d535ac8fcee1fb6bdb2977 (diff)
downloadrust-6eb956fcbb040d9d4276d97944b5c6df2f84ede8.tar.gz
rust-6eb956fcbb040d9d4276d97944b5c6df2f84ede8.zip
Auto merge of #84552 - GuillaumeGomez:open-impl-blocks-by-default, r=jsha
Open impl blocks by default

Fixes #84558.
Part of #84422.

As you can see on https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html, impl blocks are currently not open by default whereas they should.

I also realized that a test was outdated so I removed it and opened #84550 because it seems like the rustdoc-gui test suite isn't run on CI...

cc `@jyn514`
r? `@jsha`
Diffstat (limited to 'src/librustdoc/html')
-rw-r--r--src/librustdoc/html/render/mod.rs4
-rw-r--r--src/librustdoc/html/static/main.js6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 67ccf2137bf..b82967b403d 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1305,7 +1305,7 @@ fn render_impl(
         if let Some(use_absolute) = use_absolute {
             write!(
                 w,
-                "<details class=\"rustdoc-toggle implementors-toggle\">\
+                "<details class=\"rustdoc-toggle implementors-toggle\" open>\
                      <summary>\
                          <h3 id=\"{}\" class=\"impl\"{}>\
                              <code class=\"in-band\">",
@@ -1334,7 +1334,7 @@ fn render_impl(
         } else {
             write!(
                 w,
-                "<details class=\"rustdoc-toggle implementors-toggle\">\
+                "<details class=\"rustdoc-toggle implementors-toggle\" open>\
                      <summary>\
                          <h3 id=\"{}\" class=\"impl\"{}>\
                              <code class=\"in-band\">{}</code>",
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index d7e34ed02b3..7fbb97beae7 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -480,6 +480,8 @@ function hideThemeButtonState() {
                 }
                 // Open all ancestor <details> to make this element visible.
                 openParentDetails(h3.parentNode);
+            } else {
+                openParentDetails(elem.parentNode);
             }
         }
     }
@@ -1412,9 +1414,9 @@ function hideThemeButtonState() {
             // errors in mobile browsers).
             if (e.tagName === "H2" || e.tagName === "H3") {
                 var nextTagName = e.nextElementSibling.tagName;
-                if (nextTagName == "H2" || nextTagName == "H3") {
+                if (nextTagName === "H2" || nextTagName === "H3") {
                     e.nextElementSibling.style.display = "flex";
-                } else {
+                } else if (nextTagName !== "DETAILS") {
                     e.nextElementSibling.style.display = "block";
                 }
             }