Skip to content

Commit 09403b3

Browse files
Merge #378
378: Use `slice::iter` instead of `into_iter` to avoid future breakage r=jswrenn a=LukasKalbertodt `an_array.into_iter()` currently just works because of the autoref feature, which then calls `<[T] as IntoIterator>::into_iter`. But in the future, arrays will implement `IntoIterator`, too. In order to avoid problems in the future, the call is replaced by `iter()` which is shorter and more explicit. A crater run showed that your crate is affected by a potential future change. See rust-lang/rust#65819 for more information. Co-authored-by: Lukas Kalbertodt <[email protected]>
2 parents 7554521 + cb3c993 commit 09403b3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

benches/bench1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ fn multi_cartesian_product_iterator(b: &mut test::Bencher)
688688

689689
b.iter(|| {
690690
let mut sum = 0;
691-
for x in xs.into_iter().multi_cartesian_product() {
691+
for x in xs.iter().multi_cartesian_product() {
692692
sum += x[0];
693693
sum += x[1];
694694
sum += x[2];
@@ -704,7 +704,7 @@ fn multi_cartesian_product_fold(b: &mut test::Bencher)
704704

705705
b.iter(|| {
706706
let mut sum = 0;
707-
xs.into_iter().multi_cartesian_product().fold((), |(), x| {
707+
xs.iter().multi_cartesian_product().fold((), |(), x| {
708708
sum += x[0];
709709
sum += x[1];
710710
sum += x[2];

0 commit comments

Comments
 (0)