diff options
| author | Michael Howell <michael@notriddle.com> | 2023-12-07 12:49:17 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-12-07 13:02:50 -0700 |
| commit | 6a0a89af804fc93c0017486c81b191958e4b1492 (patch) | |
| tree | 5f5e5720f447959b358a1d5651a0c006b27e915a /src/librustdoc/html/static/js | |
| parent | f16c81fa79940da0c3e4cedd7b064ecdee2278bf (diff) | |
| download | rust-6a0a89af804fc93c0017486c81b191958e4b1492.tar.gz rust-6a0a89af804fc93c0017486c81b191958e4b1492.zip | |
rustdoc: remove unused parameter `reversed` from onEach(Lazy)
This feature was added in edec5807ac5ba90cbc0c61a5ec7b80f29e1eea33 to support JavaScript-based toggles that were later replaced with HTML `<details>`.
Diffstat (limited to 'src/librustdoc/html/static/js')
| -rw-r--r-- | src/librustdoc/html/static/js/storage.js | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/librustdoc/html/static/js/storage.js b/src/librustdoc/html/static/js/storage.js index c69641092ab..37250ba5a1f 100644 --- a/src/librustdoc/html/static/js/storage.js +++ b/src/librustdoc/html/static/js/storage.js @@ -51,22 +51,11 @@ function removeClass(elem, className) { * Run a callback for every element of an Array. * @param {Array<?>} arr - The array to iterate over * @param {function(?)} func - The callback - * @param {boolean} [reversed] - Whether to iterate in reverse */ -function onEach(arr, func, reversed) { - if (arr && arr.length > 0) { - if (reversed) { - for (let i = arr.length - 1; i >= 0; --i) { - if (func(arr[i])) { - return true; - } - } - } else { - for (const elem of arr) { - if (func(elem)) { - return true; - } - } +function onEach(arr, func) { + for (const elem of arr) { + if (func(elem)) { + return true; } } return false; @@ -80,14 +69,12 @@ function onEach(arr, func, reversed) { * https://developer.mozilla.org/en-US/docs/Web/API/NodeList * @param {NodeList<?>|HTMLCollection<?>} lazyArray - An array to iterate over * @param {function(?)} func - The callback - * @param {boolean} [reversed] - Whether to iterate in reverse */ // eslint-disable-next-line no-unused-vars -function onEachLazy(lazyArray, func, reversed) { +function onEachLazy(lazyArray, func) { return onEach( Array.prototype.slice.call(lazyArray), - func, - reversed); + func); } function updateLocalStorage(name, value) { |
