]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Stop hiding entire item declarations
authorManish Goregaokar <manishsmail@gmail.com>
Sun, 21 Mar 2021 00:36:19 +0000 (17:36 -0700)
committerManish Goregaokar <manishsmail@gmail.com>
Mon, 12 Apr 2021 15:45:45 +0000 (08:45 -0700)
src/librustdoc/html/render/mod.rs
src/librustdoc/html/render/print_item.rs
src/librustdoc/html/static/main.js

index fbe799e718482e7792a6d1c8cf5306d818709935..ca754fa347b514db62e997341736f223ba20c8c5 100644 (file)
@@ -486,17 +486,6 @@ fn settings(root_path: &str, suffix: &str, themes: &[StylePath]) -> Result<Strin
             ],
         )
             .into(),
-        (
-            "Auto-hide item declarations",
-            vec![
-                ("auto-hide-struct", "Auto-hide structs declaration", true),
-                ("auto-hide-enum", "Auto-hide enums declaration", false),
-                ("auto-hide-union", "Auto-hide unions declaration", true),
-                ("auto-hide-trait", "Auto-hide traits declaration", true),
-                ("auto-hide-macro", "Auto-hide macros declaration", false),
-            ],
-        )
-            .into(),
         ("auto-hide-attributes", "Auto-hide item attributes.", true).into(),
         ("auto-hide-method-docs", "Auto-hide item methods' documentation", false).into(),
         ("auto-hide-trait-implementations", "Auto-hide trait implementation documentation", true)
index 0cdfe435b9c9346379c5d2a6da808c1266c080af..6c0c8a0101439e04f99877975b8f1145c17aec55 100644 (file)
@@ -1171,7 +1171,7 @@ fn wrap_into_docblock<F>(w: &mut Buffer, f: F)
 where
     F: FnOnce(&mut Buffer),
 {
-    w.write_str("<div class=\"docblock type-decl hidden-by-usual-hider\">");
+    w.write_str("<div class=\"docblock type-decl\">");
     f(w);
     w.write_str("</div>")
 }
index 80dc6b923f68d8ee0df5d32e99b4dc64ce21e386..0abfe18a19f399d6cca98cc8e76e5c4242e81627 100644 (file)
@@ -2683,18 +2683,7 @@ function hideThemeButtonState() {
                 });
             }
         }
-        var showItemDeclarations = getSettingValue("auto-hide-" + className);
-        if (showItemDeclarations === null) {
-            if (className === "enum" || className === "macro") {
-                showItemDeclarations = "false";
-            } else if (className === "struct" || className === "union" || className === "trait") {
-                showItemDeclarations = "true";
-            } else {
-                // In case we found an unknown type, we just use the "parent" value.
-                showItemDeclarations = getSettingValue("auto-hide-declarations");
-            }
-        }
-        showItemDeclarations = showItemDeclarations === "false";
+
         function buildToggleWrapper(e) {
             if (hasClass(e, "autohide")) {
                 var wrap = e.previousElementSibling;
@@ -2721,11 +2710,8 @@ function hideThemeButtonState() {
                 var extraClass;
 
                 if (hasClass(e, "type-decl")) {
-                    fontSize = "20px";
-                    otherMessage = "&nbsp;Show&nbsp;declaration";
-                    if (showItemDeclarations === false) {
-                        extraClass = "collapsed";
-                    }
+                    // We do something special for these
+                    return;
                 } else if (hasClass(e, "sub-variant")) {
                     otherMessage = "&nbsp;Show&nbsp;fields";
                 } else if (hasClass(e, "non-exhaustive")) {
@@ -2750,11 +2736,8 @@ function hideThemeButtonState() {
                         otherMessage,
                         fontSize,
                         extraClass,
-                        hasClass(e, "type-decl") === false || showItemDeclarations === true),
+                        false),
                     e);
-                if (hasClass(e, "type-decl") === true && showItemDeclarations === true) {
-                    collapseDocs(e.previousSibling.childNodes[0], "toggle");
-                }
                 if (hasClass(e, "non-exhaustive") === true) {
                     collapseDocs(e.previousSibling.childNodes[0], "toggle");
                 }