Skip to content

Commit 6a0a89a

Browse files
committed
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>`.
1 parent f16c81f commit 6a0a89a

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

src/librustdoc/html/static/js/storage.js

+6-19
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,11 @@ function removeClass(elem, className) {
5151
* Run a callback for every element of an Array.
5252
* @param {Array<?>} arr - The array to iterate over
5353
* @param {function(?)} func - The callback
54-
* @param {boolean} [reversed] - Whether to iterate in reverse
5554
*/
56-
function onEach(arr, func, reversed) {
57-
if (arr && arr.length > 0) {
58-
if (reversed) {
59-
for (let i = arr.length - 1; i >= 0; --i) {
60-
if (func(arr[i])) {
61-
return true;
62-
}
63-
}
64-
} else {
65-
for (const elem of arr) {
66-
if (func(elem)) {
67-
return true;
68-
}
69-
}
55+
function onEach(arr, func) {
56+
for (const elem of arr) {
57+
if (func(elem)) {
58+
return true;
7059
}
7160
}
7261
return false;
@@ -80,14 +69,12 @@ function onEach(arr, func, reversed) {
8069
* https://developer.mozilla.org/en-US/docs/Web/API/NodeList
8170
* @param {NodeList<?>|HTMLCollection<?>} lazyArray - An array to iterate over
8271
* @param {function(?)} func - The callback
83-
* @param {boolean} [reversed] - Whether to iterate in reverse
8472
*/
8573
// eslint-disable-next-line no-unused-vars
86-
function onEachLazy(lazyArray, func, reversed) {
74+
function onEachLazy(lazyArray, func) {
8775
return onEach(
8876
Array.prototype.slice.call(lazyArray),
89-
func,
90-
reversed);
77+
func);
9178
}
9279

9380
function updateLocalStorage(name, value) {

0 commit comments

Comments
 (0)