From 6952431d84c73f28071df865a9f64ed26eaeeaf8 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Mon, 21 Dec 2020 20:11:05 -0800 Subject: [PATCH] More correctly state what happens when iterating over Rust array types As of Rust 1.48, array types do not actually implement IntoIterator, which means that the borrow checker automatically introduces borrows with surprising results. This behavior is now explicitly marked as unstable: warning: this method call currently resolves to `<&[T; N] as IntoIterator>::into_iter` (due to autoref coercions), but that might change in the future when `IntoIterator` impls for arrays are added. warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! note: for more information, see issue #66145 This commit changes the into_iter() calls into iter() calls that match the current behavior in Rust. --- src/save/puzzles/noreturn.rs | 2 +- src/save/puzzles/order.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/save/puzzles/noreturn.rs b/src/save/puzzles/noreturn.rs index c5e2092..81b68c8 100644 --- a/src/save/puzzles/noreturn.rs +++ b/src/save/puzzles/noreturn.rs @@ -163,7 +163,7 @@ impl Tomlable for NoReturnState { let value = cmp::min(value, order.len() - 1); order[index] = value; } - for (index, value) in order.clone().into_iter().enumerate() { + for (index, value) in order.clone().iter().enumerate() { if order[..index].contains(value) { order = INITIAL_ORDER; break; diff --git a/src/save/puzzles/order.rs b/src/save/puzzles/order.rs index c82a21b..90628cc 100644 --- a/src/save/puzzles/order.rs +++ b/src/save/puzzles/order.rs @@ -158,7 +158,7 @@ impl Tomlable for OrderState { let value = cmp::min(cmp::max(0, value) as usize, order.len() - 1); order[index] = value; } - for (index, value) in order.clone().into_iter().enumerate() { + for (index, value) in order.clone().iter().enumerate() { if order[..index].contains(value) { order = *INITIAL_ORDER; break;