We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5a1b16 commit de354f4Copy full SHA for de354f4
src/lib.rs
@@ -1910,12 +1910,7 @@ pub trait Itertools: Iterator {
1910
where
1911
P: FnMut(&Self::Item) -> bool,
1912
{
1913
- for (index, elt) in self.enumerate() {
1914
- if pred(&elt) {
1915
- return Some((index, elt));
1916
- }
1917
1918
- None
+ self.enumerate().find(|x| pred(&x.1))
1919
}
1920
/// Find the value of the first element satisfying a predicate or return the last element, if any.
1921
///
src/unique_impl.rs
@@ -110,9 +110,10 @@ where
110
if let Entry::Vacant(entry) = used.entry(v) {
111
let elt = entry.key().clone();
112
entry.insert(());
113
- return Some(elt);
+ Some(elt)
114
+ } else {
115
+ None
116
117
})
118
119
0 commit comments