Skip to content

rustdoc: Fix Auto-hide trait implementations #72511

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

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 5 additions & 5 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2218,7 +2218,7 @@ function getSearchElement() {
}

if ((!relatedDoc && hasClass(docblock, "docblock") === false) ||
(pageId && document.getElementById(pageId))) {
(pageId && parentElem.id === pageId)) {
return;
}

Expand Down Expand Up @@ -2248,13 +2248,13 @@ function getSearchElement() {
}
}

function collapser(e, collapse) {
function collapser(e, pageId) {
// inherent impl ids are like "impl" or impl-<number>'.
// they will never be hidden by default.
var n = e.parentElement;
if (n.id.match(/^impl(?:-\d+)?$/) === null) {
// Automatically minimize all non-inherent impls
if (collapse || hasClass(n, "impl")) {
if (hasClass(n, "impl")) {
collapseDocs(e, "hide", pageId);
}
}
Expand All @@ -2268,15 +2268,15 @@ function getSearchElement() {

if (impl_list !== null) {
onEachLazy(impl_list.getElementsByClassName("collapse-toggle"), function(e) {
collapser(e, collapse);
collapser(e, pageId);
});
}

var blanket_list = document.getElementById("blanket-implementations-list");

if (blanket_list !== null) {
onEachLazy(blanket_list.getElementsByClassName("collapse-toggle"), function(e) {
collapser(e, collapse);
collapser(e, pageId);
});
}
}
Expand Down