Skip to content

Commit da8da5e

Browse files
Rollup merge of #58150 - GuillaumeGomez:dont-apply-impl-collapse-rules-to-trait-impls, r=Manishearth
Don't apply impl block collapse rules to trait impls Fixes #58147. r? @QuietMisdreavus
2 parents 064b787 + 729e37d commit da8da5e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/librustdoc/html/static/main.js

+9-8
Original file line numberDiff line numberDiff line change
@@ -1935,9 +1935,9 @@ if (!DOMTokenList.prototype.remove) {
19351935
};
19361936
}
19371937

1938-
function implHider(addOrRemove) {
1938+
function implHider(addOrRemove, fullHide) {
19391939
return function(n) {
1940-
var is_method = hasClass(n, "method");
1940+
var is_method = hasClass(n, "method") || fullHide;
19411941
if (is_method || hasClass(n, "type")) {
19421942
if (is_method === true) {
19431943
if (addOrRemove) {
@@ -1991,7 +1991,7 @@ if (!DOMTokenList.prototype.remove) {
19911991
}
19921992
}
19931993
} else {
1994-
// we are collapsing the impl block
1994+
// we are collapsing the impl block(s).
19951995

19961996
var parentElem = toggle.parentNode;
19971997
relatedDoc = parentElem;
@@ -2006,7 +2006,7 @@ if (!DOMTokenList.prototype.remove) {
20062006
return;
20072007
}
20082008

2009-
// Hide all functions, but not associated types/consts
2009+
// Hide all functions, but not associated types/consts.
20102010

20112011
if (mode === "toggle") {
20122012
if (hasClass(relatedDoc, "fns-now-collapsed") ||
@@ -2017,16 +2017,17 @@ if (!DOMTokenList.prototype.remove) {
20172017
}
20182018
}
20192019

2020+
var dontApplyBlockRule = toggle.parentNode.parentNode.id !== "main";
20202021
if (action === "show") {
20212022
removeClass(relatedDoc, "fns-now-collapsed");
20222023
removeClass(docblock, "hidden-by-usual-hider");
2023-
onEachLazy(toggle.childNodes, adjustToggle(false));
2024-
onEachLazy(relatedDoc.childNodes, implHider(false));
2024+
onEachLazy(toggle.childNodes, adjustToggle(false, dontApplyBlockRule));
2025+
onEachLazy(relatedDoc.childNodes, implHider(false, dontApplyBlockRule));
20252026
} else if (action === "hide") {
20262027
addClass(relatedDoc, "fns-now-collapsed");
20272028
addClass(docblock, "hidden-by-usual-hider");
2028-
onEachLazy(toggle.childNodes, adjustToggle(true));
2029-
onEachLazy(relatedDoc.childNodes, implHider(true));
2029+
onEachLazy(toggle.childNodes, adjustToggle(true, dontApplyBlockRule);
2030+
onEachLazy(relatedDoc.childNodes, implHider(true, dontApplyBlockRule));
20302031
}
20312032
}
20322033
}

0 commit comments

Comments
 (0)