about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/html/static/main.js17
-rw-r--r--src/librustdoc/html/static/rustdoc.css7
2 files changed, 14 insertions, 10 deletions
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 3174c1be3ad..b3110071639 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -2088,7 +2088,7 @@
         return wrapper;
     }
 
-    var hideItemDeclarations = getCurrentValue('rustdoc-item-declarations') === "false";
+    var showItemDeclarations = getCurrentValue('rustdoc-item-declarations') === "false";
     function buildToggleWrapper(e) {
         if (hasClass(e, 'autohide')) {
             var wrap = e.previousElementSibling;
@@ -2117,7 +2117,7 @@
             if (hasClass(e, "type-decl")) {
                 fontSize = "20px";
                 otherMessage = ' Show declaration';
-                if (hideItemDeclarations === false) {
+                if (showItemDeclarations === false) {
                     extraClass = 'collapsed';
                 }
             } else if (hasClass(e, "sub-variant")) {
@@ -2136,12 +2136,13 @@
                 extraClass = "marg-left";
             }
 
-            e.parentNode.insertBefore(createToggle(otherMessage,
-                                                   fontSize,
-                                                   extraClass,
-                                                   hideItemDeclarations),
-                                      e);
-            if (otherMessage.length > 0 && hideItemDeclarations === true) {
+            e.parentNode.insertBefore(
+                createToggle(otherMessage,
+                             fontSize,
+                             extraClass,
+                             hasClass(e, "type-decl") === false || showItemDeclarations === true),
+                e);
+            if (hasClass(e, "type-decl") === true && showItemDeclarations === true) {
                 collapseDocs(e.previousSibling.childNodes[0], "toggle");
             }
         }
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 8bcb828a5ad..ad6cdfd3e73 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -282,8 +282,11 @@ nav.sub {
 	padding-left: 0;
 }
 
-.example-wrap {
+body:not(.source) .example-wrap {
 	display: inline-flex;
+}
+
+.example-wrap {
 	width: 100%;
 }
 
@@ -296,7 +299,7 @@ nav.sub {
 	text-align: right;
 }
 
-.example-wrap > pre.rust {
+body:not(.source) .example-wrap > pre.rust {
 	width: 100%;
 }