Skip to content

Commit

Permalink
Groups and Chunks laziness
Browse files Browse the repository at this point in the history
`GroupBy` and `IntoChunks` are not iterators themselves but implement `IntoIterator` instead.
Then `Groups` and `Chunks` are iterators.
All four are lazy and must be used.
  • Loading branch information
Philippe-Cholet committed Nov 13, 2023
1 parent 9074607 commit 1d2716e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tests/laziness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,18 @@ must_use_tests! {
let _ = Panicking.batching(Iterator::next);
}
group_by {
// GroupBy
let _ = Panicking.group_by(|x| *x);
// Groups
let _ = Panicking.group_by(|x| *x).into_iter();
}
chunks {
// IntoChunks
let _ = Panicking.chunks(1);
let _ = Panicking.chunks(2);
// Chunks
let _ = Panicking.chunks(1).into_iter();
let _ = Panicking.chunks(2).into_iter();
}
tuple_windows {
let _ = Panicking.tuple_windows::<(_,)>();
Expand Down

0 comments on commit 1d2716e

Please sign in to comment.