From b6a397888689a22803bb364f74177e855b64c680 Mon Sep 17 00:00:00 2001 From: llogiq Date: Thu, 3 Sep 2015 12:35:34 +0200 Subject: [PATCH] clippy improvements to iterators --- src/libcore/iter.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 3d17b10ba3a..53b72fe2ba7 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1513,7 +1513,7 @@ impl Iterator for Chain where fn next(&mut self) -> Option { match self.state { ChainState::Both => match self.a.next() { - elt @ Some(..) => return elt, + elt @ Some(..) => elt, None => { self.state = ChainState::Back; self.b.next() @@ -1590,7 +1590,7 @@ impl DoubleEndedIterator for Chain where fn next_back(&mut self) -> Option { match self.state { ChainState::Both => match self.b.next_back() { - elt @ Some(..) => return elt, + elt @ Some(..) => elt, None => { self.state = ChainState::Front; self.a.next_back() @@ -1683,7 +1683,7 @@ impl Iterator for Map where F: FnMut(I::Item) -> B { #[inline] fn next(&mut self) -> Option { - self.iter.next().map(|a| (self.f)(a)) + self.iter.next().map(self.f) } #[inline] @@ -1698,7 +1698,7 @@ impl DoubleEndedIterator for Map where { #[inline] fn next_back(&mut self) -> Option { - self.iter.next_back().map(|a| (self.f)(a)) + self.iter.next_back().map(self.f) } } @@ -2210,7 +2210,7 @@ impl Iterator for FlatMap return Some(x) } } - match self.iter.next().map(|x| (self.f)(x)) { + match self.iter.next().map(self.f) { None => return self.backiter.as_mut().and_then(|it| it.next()), next => self.frontiter = next.map(IntoIterator::into_iter), } @@ -2243,7 +2243,7 @@ impl DoubleEndedIterator for FlatMap wher return Some(y) } } - match self.iter.next_back().map(|x| (self.f)(x)) { + match self.iter.next_back().map(self.f) { None => return self.frontiter.as_mut().and_then(|it| it.next_back()), next => self.backiter = next.map(IntoIterator::into_iter), }