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.
FilterOk::next
find
1 parent cfb2774 commit b19eb9eCopy full SHA for b19eb9e
src/adaptors/mod.rs
@@ -901,17 +901,11 @@ where
901
type Item = Result<T, E>;
902
903
fn next(&mut self) -> Option<Self::Item> {
904
- loop {
905
- match self.iter.next() {
906
- Some(Ok(v)) => {
907
- if (self.f)(&v) {
908
- return Some(Ok(v));
909
- }
910
911
- Some(Err(e)) => return Some(Err(e)),
912
- None => return None,
913
914
+ let f = &mut self.f;
+ self.iter.find(|res| match res {
+ Ok(t) => f(t),
+ _ => true,
+ })
915
}
916
917
fn size_hint(&self) -> (usize, Option<usize>) {
0 commit comments