Skip to content

Commit b607fbd

Browse files
Philippe-Choletphimuemue
authored andcommitted
Fix tests 3: group to chunk (variables)
Remain `grouper`, rename it to what?
1 parent 49c85f4 commit b607fbd

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

tests/test_std.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -892,23 +892,23 @@ fn chunk_by_lazy_2() {
892892

893893
let grouper = data.iter().chunk_by(|k| *k);
894894
let mut chunks = Vec::new();
895-
for (k, group) in &grouper {
895+
for (k, chunk) in &grouper {
896896
if *k == 1 {
897-
chunks.push(group);
897+
chunks.push(chunk);
898898
}
899899
}
900900
it::assert_equal(&mut chunks[0], &[1, 1]);
901901

902902
let data = [0, 0, 0, 1, 1, 0, 0, 2, 2, 3, 3];
903903
let grouper = data.iter().chunk_by(|k| *k);
904904
let mut chunks = Vec::new();
905-
for (i, (_, group)) in grouper.into_iter().enumerate() {
905+
for (i, (_, chunk)) in grouper.into_iter().enumerate() {
906906
if i < 2 {
907-
chunks.push(group);
907+
chunks.push(chunk);
908908
} else if i < 4 {
909-
for _ in group {}
909+
for _ in chunk {}
910910
} else {
911-
chunks.push(group);
911+
chunks.push(chunk);
912912
}
913913
}
914914
it::assert_equal(&mut chunks[0], &[0, 0, 0]);
@@ -922,30 +922,30 @@ fn chunk_by_lazy_2() {
922922
i += 1;
923923
k
924924
});
925-
for (i, group) in &grouper {
925+
for (i, chunk) in &grouper {
926926
match i {
927-
0 => it::assert_equal(group, &[0, 0, 0]),
928-
1 => it::assert_equal(group, &[1, 1, 0]),
929-
2 => it::assert_equal(group, &[0, 2, 2]),
930-
3 => it::assert_equal(group, &[3, 3]),
927+
0 => it::assert_equal(chunk, &[0, 0, 0]),
928+
1 => it::assert_equal(chunk, &[1, 1, 0]),
929+
2 => it::assert_equal(chunk, &[0, 2, 2]),
930+
3 => it::assert_equal(chunk, &[3, 3]),
931931
_ => unreachable!(),
932932
}
933933
}
934934
}
935935

936936
#[test]
937937
fn chunk_by_lazy_3() {
938-
// test consuming each group on the lap after it was produced
938+
// test consuming each chunk on the lap after it was produced
939939
let data = [0, 0, 0, 1, 1, 0, 0, 1, 1, 2, 2];
940940
let grouper = data.iter().chunk_by(|elt| *elt);
941941
let mut last = None;
942-
for (key, group) in &grouper {
942+
for (key, chunk) in &grouper {
943943
if let Some(gr) = last.take() {
944944
for elt in gr {
945945
assert!(elt != key && i32::abs(elt - key) == 1);
946946
}
947947
}
948-
last = Some(group);
948+
last = Some(chunk);
949949
}
950950
}
951951

0 commit comments

Comments
 (0)