about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2019-02-04 15:50:46 +0100
committerGuillaume Gomez <guillaume1.gomez@gmail.com>2019-02-07 11:48:31 +0100
commit729e37da4dd68adbd42d3a91791d01b170be38e5 (patch)
tree12fc9561a97da29c4966fd3452c769d9fb073b12
parent19f8958f827e379be9b0ffc93fca580ec8ffac77 (diff)
downloadrust-729e37da4dd68adbd42d3a91791d01b170be38e5.tar.gz
rust-729e37da4dd68adbd42d3a91791d01b170be38e5.zip
Don't apply impl block collapse rules to trait impls
-rw-r--r--src/librustdoc/html/static/main.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 82604cc7ad8..1c38bdb1dea 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -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) {
@@ -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;
@@ -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") ||
@@ -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));
             }
         }
     }