Skip to content

Commit c96f86d

Browse files
committed
rustdoc: Stop hiding entire item declarations
1 parent c18c0ad commit c96f86d

File tree

3 files changed

+5
-33
lines changed

3 files changed

+5
-33
lines changed

Diff for: src/librustdoc/html/render/mod.rs

-11
Original file line numberDiff line numberDiff line change
@@ -486,17 +486,6 @@ fn settings(root_path: &str, suffix: &str, themes: &[StylePath]) -> Result<Strin
486486
],
487487
)
488488
.into(),
489-
(
490-
"Auto-hide item declarations",
491-
vec![
492-
("auto-hide-struct", "Auto-hide structs declaration", true),
493-
("auto-hide-enum", "Auto-hide enums declaration", false),
494-
("auto-hide-union", "Auto-hide unions declaration", true),
495-
("auto-hide-trait", "Auto-hide traits declaration", true),
496-
("auto-hide-macro", "Auto-hide macros declaration", false),
497-
],
498-
)
499-
.into(),
500489
("auto-hide-attributes", "Auto-hide item attributes.", true).into(),
501490
("auto-hide-method-docs", "Auto-hide item methods' documentation", false).into(),
502491
("auto-hide-trait-implementations", "Auto-hide trait implementation documentation", true)

Diff for: src/librustdoc/html/render/print_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ fn wrap_into_docblock<F>(w: &mut Buffer, f: F)
11711171
where
11721172
F: FnOnce(&mut Buffer),
11731173
{
1174-
w.write_str("<div class=\"docblock type-decl hidden-by-usual-hider\">");
1174+
w.write_str("<div class=\"docblock type-decl\">");
11751175
f(w);
11761176
w.write_str("</div>")
11771177
}

Diff for: src/librustdoc/html/static/main.js

+4-21
Original file line numberDiff line numberDiff line change
@@ -2683,18 +2683,7 @@ function hideThemeButtonState() {
26832683
});
26842684
}
26852685
}
2686-
var showItemDeclarations = getSettingValue("auto-hide-" + className);
2687-
if (showItemDeclarations === null) {
2688-
if (className === "enum" || className === "macro") {
2689-
showItemDeclarations = "false";
2690-
} else if (className === "struct" || className === "union" || className === "trait") {
2691-
showItemDeclarations = "true";
2692-
} else {
2693-
// In case we found an unknown type, we just use the "parent" value.
2694-
showItemDeclarations = getSettingValue("auto-hide-declarations");
2695-
}
2696-
}
2697-
showItemDeclarations = showItemDeclarations === "false";
2686+
26982687
function buildToggleWrapper(e) {
26992688
if (hasClass(e, "autohide")) {
27002689
var wrap = e.previousElementSibling;
@@ -2721,11 +2710,8 @@ function hideThemeButtonState() {
27212710
var extraClass;
27222711

27232712
if (hasClass(e, "type-decl")) {
2724-
fontSize = "20px";
2725-
otherMessage = "&nbsp;Show&nbsp;declaration";
2726-
if (showItemDeclarations === false) {
2727-
extraClass = "collapsed";
2728-
}
2713+
// We do something special for these
2714+
return;
27292715
} else if (hasClass(e, "sub-variant")) {
27302716
otherMessage = "&nbsp;Show&nbsp;fields";
27312717
} else if (hasClass(e, "non-exhaustive")) {
@@ -2750,11 +2736,8 @@ function hideThemeButtonState() {
27502736
otherMessage,
27512737
fontSize,
27522738
extraClass,
2753-
hasClass(e, "type-decl") === false || showItemDeclarations === true),
2739+
false),
27542740
e);
2755-
if (hasClass(e, "type-decl") === true && showItemDeclarations === true) {
2756-
collapseDocs(e.previousSibling.childNodes[0], "toggle");
2757-
}
27582741
if (hasClass(e, "non-exhaustive") === true) {
27592742
collapseDocs(e.previousSibling.childNodes[0], "toggle");
27602743
}

0 commit comments

Comments
 (0)