From c96f86de3026f864e78397aff9097e885f2f8fdf Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sat, 20 Mar 2021 17:36:19 -0700 Subject: [PATCH] rustdoc: Stop hiding entire item declarations --- src/librustdoc/html/render/mod.rs | 11 ----------- src/librustdoc/html/render/print_item.rs | 2 +- src/librustdoc/html/static/main.js | 25 ++++-------------------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index fbe799e718482..ca754fa347b51 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -486,17 +486,6 @@ fn settings(root_path: &str, suffix: &str, themes: &[StylePath]) -> Result(w: &mut Buffer, f: F) where F: FnOnce(&mut Buffer), { - w.write_str("
"); + w.write_str("
"); f(w); w.write_str("
") } diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 80dc6b923f68d..0abfe18a19f39 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -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 = " Show declaration"; - if (showItemDeclarations === false) { - extraClass = "collapsed"; - } + // We do something special for these + return; } else if (hasClass(e, "sub-variant")) { otherMessage = " Show 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"); }