Skip to content

Commit

Permalink
Rollup merge of #118722 - notriddle:notriddle/dom-opt-3, r=GuillaumeG…
Browse files Browse the repository at this point in the history
…omez

rustdoc: remove unused parameter `reversed` from onEach(Lazy)

This feature was added in edec580 to support JavaScript-based toggles that were later replaced with HTML `<details>`.
  • Loading branch information
matthiaskrgr authored Dec 8, 2023
2 parents beabb5e + 6a0a89a commit 9dd34d5
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/librustdoc/html/static/js/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down

0 comments on commit 9dd34d5

Please sign in to comment.