about summary refs log tree commit diff
diff options
context:
space:
mode:
authornasso <nassomails@gmail.com>2020-10-11 17:52:47 +0200
committernasso <nassomails@gmail.com>2020-10-13 10:46:30 +0200
commitdb7c8f4c3c181b14cc1d12ee1a5a17e249dbc65b (patch)
tree0f56bc1d48b28f7020ee34976a05b920ad232fb0
parent3a6437cd985f11c978da5fa15c5dea7a9d0393c2 (diff)
downloadrust-db7c8f4c3c181b14cc1d12ee1a5a17e249dbc65b.tar.gz
rust-db7c8f4c3c181b14cc1d12ee1a5a17e249dbc65b.zip
Coding style fixes
-rw-r--r--src/librustdoc/html/render/mod.rs8
-rw-r--r--src/librustdoc/html/static/settings.css7
-rw-r--r--src/librustdoc/html/static/settings.js19
-rw-r--r--src/librustdoc/html/static/storage.js13
4 files changed, 22 insertions, 25 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index b7b9bc5e1c0..43229420315 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1386,11 +1386,11 @@ impl Setting {
                 description,
             ),
             Setting::Select { js_data_name, description, default_value, ref options } => format!(
-                "<div class='setting-line'>\
+                "<div class=\"setting-line\">\
                      <div>{}</div>\
-                     <label class='select-wrapper'>\
-                         <select id='{}' autocomplete='off'>{}</select>\
-                         <img src='{}down-arrow{}.svg' alt='Select item'>\
+                     <label class=\"select-wrapper\">\
+                         <select id=\"{}\" autocomplete=\"off\">{}</select>\
+                         <img src=\"{}down-arrow{}.svg\" alt=\"Select item\">\
                      </label>\
                  </div>",
                 description,
diff --git a/src/librustdoc/html/static/settings.css b/src/librustdoc/html/static/settings.css
index 7c91f6b7d18..4bacd7b245b 100644
--- a/src/librustdoc/html/static/settings.css
+++ b/src/librustdoc/html/static/settings.css
@@ -31,9 +31,7 @@
 
 .select-wrapper {
 	float: right;
-
 	position: relative;
-
 	height: 27px;
 	min-width: 25%;
 }
@@ -42,23 +40,18 @@
 	appearance: none;
 	-moz-appearance: none;
 	-webkit-appearance: none;
-
 	background: none;
 	border: 2px solid #ccc;
 	padding-right: 28px;
-
 	width: 100%;
 }
 
 .select-wrapper img {
 	pointer-events: none;
-
 	position: absolute;
 	right: 0;
 	bottom: 0;
-
 	background: #ccc;
-
 	height: 100%;
 	width: 28px;
 	padding: 0px 4px;
diff --git a/src/librustdoc/html/static/settings.js b/src/librustdoc/html/static/settings.js
index 67dc77330ee..00a01ac30bc 100644
--- a/src/librustdoc/html/static/settings.js
+++ b/src/librustdoc/html/static/settings.js
@@ -1,21 +1,21 @@
 // Local js definitions:
-/* global getCurrentValue, updateLocalStorage */
+/* global getCurrentValue, updateLocalStorage, updateSystemTheme */
 
 (function () {
     function changeSetting(settingName, value) {
-        updateLocalStorage('rustdoc-' + settingName, value);
+        updateLocalStorage("rustdoc-" + settingName, value);
 
         switch (settingName) {
-            case 'preferred-dark-theme':
-            case 'preferred-light-theme':
-            case 'use-system-theme':
+            case "preferred-dark-theme":
+            case "preferred-light-theme":
+            case "use-system-theme":
                 updateSystemTheme();
                 break;
         }
     }
 
     function getSettingValue(settingName) {
-        return getCurrentValue('rustdoc-' + settingName);
+        return getCurrentValue("rustdoc-" + settingName);
     }
 
     function setEvents() {
@@ -23,9 +23,10 @@
             toggles: document.getElementsByClassName("slider"),
             selects: document.getElementsByClassName("select-wrapper")
         };
+        var i;
 
         if (elems.toggles && elems.toggles.length > 0) {
-            for (var i = 0; i < elems.toggles.length; ++i) {
+            for (i = 0; i < elems.toggles.length; ++i) {
                 var toggle = elems.toggles[i].previousElementSibling;
                 var settingId = toggle.id;
                 var settingValue = getSettingValue(settingId);
@@ -39,8 +40,8 @@
         }
 
         if (elems.selects && elems.selects.length > 0) {
-            for (var i = 0; i < elems.selects.length; ++i) {
-                var select = elems.selects[i].getElementsByTagName('select')[0];
+            for (i = 0; i < elems.selects.length; ++i) {
+                var select = elems.selects[i].getElementsByTagName("select")[0];
                 var settingId = select.id;
                 var settingValue = getSettingValue(settingId);
                 if (settingValue !== null) {
diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js
index 3ee693d6eac..cf8b806501f 100644
--- a/src/librustdoc/html/static/storage.js
+++ b/src/librustdoc/html/static/storage.js
@@ -110,8 +110,8 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) {
     });
     if (found === true) {
         styleElem.href = newHref;
-        // If this new value comes from a system setting or from the previously saved theme, no
-        // need to save it.
+        // If this new value comes from a system setting or from the previously
+        // saved theme, no need to save it.
         if (saveTheme === true) {
             updateLocalStorage("rustdoc-theme", newTheme);
         }
@@ -182,7 +182,10 @@ if (getCurrentValue("rustdoc-use-system-theme") !== "false" && window.matchMedia
     // call the function to initialize the theme at least once!
     updateSystemTheme();
 } else {
-    switchTheme(currentTheme, mainTheme,
-                getCurrentValue("rustdoc-theme") || "light",
-                false);
+    switchTheme(
+        currentTheme,
+        mainTheme,
+        getCurrentValue("rustdoc-theme") || "light",
+        false
+    );
 }