Skip to content

Commit de354f4

Browse files
committed
fix clippy::while_let_on_iterator
1 parent c5a1b16 commit de354f4

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,12 +1910,7 @@ pub trait Itertools: Iterator {
19101910
where
19111911
P: FnMut(&Self::Item) -> bool,
19121912
{
1913-
for (index, elt) in self.enumerate() {
1914-
if pred(&elt) {
1915-
return Some((index, elt));
1916-
}
1917-
}
1918-
None
1913+
self.enumerate().find(|x| pred(&x.1))
19191914
}
19201915
/// Find the value of the first element satisfying a predicate or return the last element, if any.
19211916
///

src/unique_impl.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,10 @@ where
110110
if let Entry::Vacant(entry) = used.entry(v) {
111111
let elt = entry.key().clone();
112112
entry.insert(());
113-
return Some(elt);
113+
Some(elt)
114+
} else {
115+
None
114116
}
115-
None
116117
})
117118
}
118119

0 commit comments

Comments
 (0)