Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't apply impl block collapse rules to trait impls #58150

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -1918,9 +1918,9 @@ if (!DOMTokenList.prototype.remove) {
};
}

function implHider(addOrRemove) {
function implHider(addOrRemove, fullHide) {
return function(n) {
var is_method = hasClass(n, "method");
var is_method = hasClass(n, "method") || fullHide;
if (is_method || hasClass(n, "type")) {
if (is_method === true) {
if (addOrRemove) {
Expand Down Expand Up @@ -1974,7 +1974,7 @@ if (!DOMTokenList.prototype.remove) {
}
}
} else {
// we are collapsing the impl block
// we are collapsing the impl block(s).

var parentElem = toggle.parentNode;
relatedDoc = parentElem;
Expand All @@ -1989,7 +1989,7 @@ if (!DOMTokenList.prototype.remove) {
return;
}

// Hide all functions, but not associated types/consts
// Hide all functions, but not associated types/consts.

if (mode === "toggle") {
if (hasClass(relatedDoc, "fns-now-collapsed") ||
Expand All @@ -2000,16 +2000,17 @@ if (!DOMTokenList.prototype.remove) {
}
}

var dontApplyBlockRule = toggle.parentNode.parentNode.id !== "main";
if (action === "show") {
removeClass(relatedDoc, "fns-now-collapsed");
removeClass(docblock, "hidden-by-usual-hider");
onEachLazy(toggle.childNodes, adjustToggle(false));
onEachLazy(relatedDoc.childNodes, implHider(false));
onEachLazy(toggle.childNodes, adjustToggle(false, dontApplyBlockRule));
onEachLazy(relatedDoc.childNodes, implHider(false, dontApplyBlockRule));
} else if (action === "hide") {
addClass(relatedDoc, "fns-now-collapsed");
addClass(docblock, "hidden-by-usual-hider");
onEachLazy(toggle.childNodes, adjustToggle(true));
onEachLazy(relatedDoc.childNodes, implHider(true));
onEachLazy(toggle.childNodes, adjustToggle(true, dontApplyBlockRule);
onEachLazy(relatedDoc.childNodes, implHider(true, dontApplyBlockRule));
}
}
}
Expand Down