From aecf20bc7434bb1f2e1483c640809042d0568e1c Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Sun, 18 Apr 2021 21:32:33 +0200 Subject: [PATCH] rustdoc: Remove double toggle to show undocumented items --- src/librustdoc/html/static/main.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index d71cc15a4576f..68d8335400126 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2682,6 +2682,13 @@ function hideThemeButtonState() { inner_toggle.onclick = toggleClicked; e.insertBefore(inner_toggle, e.firstChild); impl_call(e.previousSibling, inner_toggle); + + // If *all* the items are hidden by default, remove the unnecessary indirection + // by toggling the items to be visible and removing the toggle. + if (e.childElementCount - 1 === hiddenElems.length) { + inner_toggle.click(); + e.removeChild(inner_toggle); + } } });