X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustdoc%2Fhtml%2Fstatic%2Fstorage.js;h=208afd2e732dd7366a577bda9321f9adab1e8050;hb=f510e412e93958e099334de22de375d26264e767;hp=2ed87fdedaec686616e46c3b6435bd5d3b63384d;hpb=080d30235fff4373fc5ce9f84875e3be91d1a09e;p=rust.git diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js index 2ed87fdedae..208afd2e732 100644 --- a/src/librustdoc/html/static/storage.js +++ b/src/librustdoc/html/static/storage.js @@ -59,15 +59,15 @@ function onEach(arr, func, reversed) { if (arr && arr.length > 0 && func) { var length = arr.length; var i; - if (reversed !== true) { - for (i = 0; i < length; ++i) { - if (func(arr[i]) === true) { + if (reversed) { + for (i = length - 1; i >= 0; --i) { + if (func(arr[i])) { return true; } } } else { - for (i = length - 1; i >= 0; --i) { - if (func(arr[i]) === true) { + for (i = 0; i < length; ++i) { + if (func(arr[i])) { return true; } } @@ -111,7 +111,7 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) { // If this new value comes from a system setting or from the previously // saved theme, no need to save it. - if (saveTheme === true) { + if (saveTheme) { updateLocalStorage("rustdoc-theme", newTheme); } @@ -131,7 +131,7 @@ function switchTheme(styleElem, mainStyleElem, newTheme, saveTheme) { return true; } }); - if (found === true) { + if (found) { styleElem.href = newHref; } }