Replace .map.flatten with .flat_map

This commit is contained in:
GBA bot 2022-01-01 11:35:17 +00:00
parent afe69b98b8
commit 5f13c69fcf

View file

@ -865,12 +865,11 @@ impl<T: FixedWidthUnsignedInteger + core::iter::Step> Rect<T> {
pub fn iter(self) -> impl Iterator<Item = (T, T)> { pub fn iter(self) -> impl Iterator<Item = (T, T)> {
(self.position.x..=(self.position.x + self.size.x)) (self.position.x..=(self.position.x + self.size.x))
.into_iter() .into_iter()
.map(move |x| { .flat_map(move |x| {
(self.position.y..=(self.position.y + self.size.y)) (self.position.y..=(self.position.y + self.size.y))
.into_iter() .into_iter()
.map(move |y| (x, y)) .map(move |y| (x, y))
}) })
.flatten()
} }
} }