Skip to content

Commit 834bcc5

Browse files
committed
Add {min,max}_set(_by{_key)?)? functions (4) use internal iteration
We may relax this bound at some point, but I'd go with this until we have evidence that it bothers users, as there have been cases where I actually was happy to be informed about Ord vs PartialOrd.
1 parent 491b34a commit 834bcc5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/extrema_set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn min_set_impl<I, K, F, L>(mut it: I,
1414
}
1515
};
1616

17-
for element in it {
17+
it.for_each(|element| {
1818
let key = key_for(&element);
1919
if lt(&element, &result[0], &key, &current_key) {
2020
result.clear();
@@ -23,7 +23,7 @@ pub fn min_set_impl<I, K, F, L>(mut it: I,
2323
} else if !lt(&result[0], &element, &current_key, &key) {
2424
result.push(element);
2525
}
26-
}
26+
});
2727

2828
result
2929
}

0 commit comments

Comments
 (0)