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.
1 parent 82d42b1 commit 7e9e1fcCopy full SHA for 7e9e1fc
tests/test_core.rs
@@ -180,15 +180,10 @@ fn batching() {
180
let ys = [(0, 1), (2, 1)];
181
182
// An iterator that gathers elements up in pairs
183
- let pit = xs.iter().cloned().batching(|it| {
184
- match it.next() {
185
- None => None,
186
- Some(x) => match it.next() {
187
188
- Some(y) => Some((x, y)),
189
- }
190
191
- });
+ let pit = xs
+ .iter()
+ .cloned()
+ .batching(|it| it.next().and_then(|x| it.next().map(|y| (x, y))));
192
it::assert_equal(pit, ys.iter().cloned());
193
}
194
0 commit comments