diff --git a/src/lib.rs b/src/lib.rs index 211827ff2..b2641d19d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1910,12 +1910,7 @@ pub trait Itertools: Iterator { where P: FnMut(&Self::Item) -> bool, { - for (index, elt) in self.enumerate() { - if pred(&elt) { - return Some((index, elt)); - } - } - None + self.enumerate().find(|(_, elt)| pred(elt)) } /// Find the value of the first element satisfying a predicate or return the last element, if any. ///