Change:
When pressing the hotkey on type's documentation such as on the , the methods of the are still shown. This is however mostly useless information that gets in the way of scrolling to see what traits a type implements. It would be more ergonomic if would hide every method of every trait but still show all associated items (types and consts) for each (since they carry useful information). In addition, a / link should be on all the s (including non-trait impls) either besides or to the left of the (as done with s this expands and collapses the impls but keeps associated items shown.
I can rewrite this as an RFC if required, but I was unsure about the protocol wrt. rustdoc.
Similar request:
Closing as resolved.

Discussion:
document.onkeydown = handleShortcut; document.onclick = function(ev) { if (hasClass(ev.target, 'collapse-toggle')) { <del> collapseDocs(ev.target); </del> <ins> collapseDocs(ev.target, "toggle"); </ins> } else if (hasClass(ev.target.parentNode, 'collapse-toggle')) { <del> collapseDocs(ev.target.parentNode); </del> <ins> collapseDocs(ev.target.parentNode, "toggle"); </ins> } else if (ev.target.tagName === 'SPAN' && hasClass(ev.target.parentNode, 'line-numbers')) { var prev_id = 0;

e.innerHTML = labelForToggleButton(false); }); toggle.title = "collapse all docs"; <del> onEach(document.getElementsByClassName("docblock"), function(e) { e.style.display = 'block'; }); onEach(document.getElementsByClassName("toggle-label"), function(e) { e.style.display = 'none'; }); onEach(document.getElementsByClassName("toggle-wrapper"), function(e) { removeClass(e, "collapsed"); }); </del> onEach(document.getElementsByClassName("collapse-toggle"), function(e) { <del> onEveryMatchingChild(e, "inner", function(i_e) { i_e.innerHTML = labelForToggleButton(false); }); </del> <ins> collapseDocs(e, "show"); </ins> }); } else { addClass(toggle, "will-expand");

e.innerHTML = labelForToggleButton(true); }); toggle.title = "expand all docs"; <del> onEach(document.getElementsByClassName("docblock"), function(e) { e.style.display = 'none'; }); onEach(document.getElementsByClassName("toggle-label"), function(e) { e.style.display = 'inline-block'; }); onEach(document.getElementsByClassName("toggle-wrapper"), function(e) { addClass(e, "collapsed"); }); </del> onEach(document.getElementsByClassName("collapse-toggle"), function(e) { <del> onEveryMatchingChild(e, "inner", function(i_e) { i_e.innerHTML = labelForToggleButton(true); }); </del> <ins> collapseDocs(e, "hide"); </ins> }); } } <del> function collapseDocs(toggle) { </del> <ins> function collapseDocs(toggle, mode) { </ins> if (!toggle || !toggle.parentNode) { return; } <del> var relatedDoc = toggle.parentNode.nextElementSibling; if (hasClass(relatedDoc, "stability")) { relatedDoc = relatedDoc.nextElementSibling; } if (hasClass(relatedDoc, "docblock")) { if (!isHidden(relatedDoc)) { relatedDoc.style.display = 'none'; onEach(toggle.childNodes, function(e) { if (hasClass(e, 'toggle-label')) { </del> <ins> function adjustToggle(arg) { return function(e) { if (hasClass(e, 'toggle-label')) { if (arg) { </ins> e.style.display = 'inline-block'; <ins> } else { e.style.display = 'none'; </ins> } <del> if (hasClass(e, 'inner')) { e.innerHTML = labelForToggleButton(true); </del> <ins> } if (hasClass(e, 'inner')) { e.innerHTML = labelForToggleButton(arg); } }; }; if (!hasClass(toggle.parentNode, "impl")) { var relatedDoc = toggle.parentNode.nextElementSibling; if (hasClass(relatedDoc, "stability")) { relatedDoc = relatedDoc.nextElementSibling; } if (hasClass(relatedDoc, "docblock")) { var action = mode; if (action === "toggle") { if (hasClass(relatedDoc, "hidden-by-usual-hider")) { action = "show"; } else { action = "hide"; </ins> } <del> }); addClass(toggle.parentNode, 'collapsed'); } else { relatedDoc.style.display = 'block'; removeClass(toggle.parentNode, 'collapsed'); onEach(toggle.childNodes, function(e) { if (hasClass(e, 'toggle-label')) { e.style.display = 'none'; </del> <ins> } if (action === "hide") { addClass(relatedDoc, "hidden-by-usual-hider"); onEach(toggle.childNodes, adjustToggle(true)); addClass(toggle.parentNode, 'collapsed'); } else if (action === "show") { removeClass(relatedDoc, "hidden-by-usual-hider"); removeClass(toggle.parentNode, 'collapsed'); onEach(toggle.childNodes, adjustToggle(false)); } } } else { // we are collapsing the impl block function implHider(addOrRemove) { return function(n) { if (hasClass(n, "method")) { if (addOrRemove) { addClass(n, "hidden-by-impl-hider"); } else { removeClass(n, "hidden-by-impl-hider"); } var ns = n.nextElementSibling; while (true) { if (ns && ( hasClass(ns, "docblock") || hasClass(ns, "stability") || false )) { if (addOrRemove) { addClass(ns, "hidden-by-impl-hider"); } else { removeClass(ns, "hidden-by-impl-hider"); } ns = ns.nextElementSibling; continue; } break; } </ins> } <del> if (hasClass(e, 'inner')) { e.innerHTML = labelForToggleButton(false); </del> <ins> } } var relatedDoc = toggle.parentNode; while (!hasClass(relatedDoc, "impl-items")) { relatedDoc = relatedDoc.nextElementSibling; } if (!relatedDoc) { return; } // Hide all functions, but not associated types/consts var action = mode; if (action === "toggle") { if (hasClass(relatedDoc, "fns-now-collapsed")) { action = "show"; } else { action = "hide"; } } if (action === "show") { removeClass(relatedDoc, "fns-now-collapsed"); onEach(toggle.childNodes, adjustToggle(false)); onEach(relatedDoc.childNodes, implHider(false)); } else if (action === "hide") { addClass(relatedDoc, "fns-now-collapsed"); onEach(toggle.childNodes, adjustToggle(true)); onEach(relatedDoc.childNodes, implHider(true)); } } } function autoCollapseAllImpls() { // Automatically minimize all non-inherent impls onEach(document.getElementsByClassName('impl'), function(n) { // inherent impl ids are like 'impl' or impl-<number>' var inherent = (n.id.match(/^impl(?:-d+)?$/) !== null); if (!inherent) { onEach(n.childNodes, function(m) { if (hasClass(m, "collapse-toggle")) { collapseDocs(m, "hide"); </ins> } }); } <del> } </del> <ins> }); </ins> } var x = document.getElementById('toggle-all-docs');

hasClass(next.nextElementSibling, 'docblock'))) { insertAfter(toggle.cloneNode(true), e.childNodes[e.childNodes.length - 1]); } <ins> if (hasClass(e, 'impl')) { insertAfter(toggle.cloneNode(true), e.childNodes[e.childNodes.length - 1]); } </ins> } onEach(document.getElementsByClassName('method'), func); <ins> onEach(document.getElementsByClassName('impl'), func); </ins> onEach(document.getElementsByClassName('impl-items'), function(e) { onEach(e.getElementsByClassName('associatedconstant'), func); });

} }) <ins> autoCollapseAllImpls(); </ins> function createToggleWrapper() { var span = document.createElement('span'); span.className = 'toggle-label';

onEach(document.getElementById('main').getElementsByTagName('pre'), function(e) { onEach(e.getElementsByClassName('attributes'), function(i_e) { i_e.parentNode.insertBefore(createToggleWrapper(), i_e); <del> collapseDocs(i_e.previousSibling.childNodes[0]); </del> <ins> collapseDocs(i_e.previousSibling.childNodes[0], "toggle"); </ins> }); });

} h3.impl, h3.method, h3.type { margin-top: 15px; <ins> padding-left: 15px; </ins> } h1, h2, h3, h4,

.anchor { display: none; position: absolute; <del> left: -25px; </del> <ins> left: -5px; </ins> } .anchor.field { <del> left: -20px; </del> <ins> left: -5px; </ins> } .anchor:before { content: '200200a72002';

z-index: -1; border-bottom: 1px solid; } <ins> .collapse-toggle { left: -17px; } </ins> }

z-index: 1; } } <ins> .hidden-by-impl-hider, .hidden-by-usual-hider { /* important because of conflicting rule for small screens */ display: none !important; } </ins>