Skip to content

Commit 4d7a2d0

Browse files
committed
Rewrite MapForGrouping Iterator::next implementation using Option::map
1 parent 69ac7ac commit 4d7a2d0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/grouping_map.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ impl<K, V, I, F> Iterator for MapForGrouping<I, F>
2323
{
2424
type Item = (K, V);
2525
fn next(&mut self) -> Option<Self::Item> {
26-
let val = self.0.next()?;
27-
Some(((self.1)(&val), val))
26+
self.0.next().map(|val| ((self.1)(&val), val))
2827
}
2928
}
3029

0 commit comments

Comments
 (0)