Skip to content

Commit

Permalink
Use slice::iter instead of into_iter to avoid future breakage
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
LukasKalbertodt committed Oct 30, 2019
1 parent 7554521 commit cb3c993
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions benches/bench1.rs
Expand Up @@ -688,7 +688,7 @@ fn multi_cartesian_product_iterator(b: &mut test::Bencher)

b.iter(|| {
let mut sum = 0;
for x in xs.into_iter().multi_cartesian_product() {
for x in xs.iter().multi_cartesian_product() {
sum += x[0];
sum += x[1];
sum += x[2];
Expand All @@ -704,7 +704,7 @@ fn multi_cartesian_product_fold(b: &mut test::Bencher)

b.iter(|| {
let mut sum = 0;
xs.into_iter().multi_cartesian_product().fold((), |(), x| {
xs.iter().multi_cartesian_product().fold((), |(), x| {
sum += x[0];
sum += x[1];
sum += x[2];
Expand Down

0 comments on commit cb3c993

Please sign in to comment.