diff options
author | Mathias Svensson <freaken@freaken.dk> | 2019-10-30 22:59:40 +0100 |
---|---|---|
committer | Mathias Svensson <freaken@freaken.dk> | 2019-10-30 22:59:40 +0100 |
commit | 02f9478674749f9e75d0aa84c321f6a9060e3b33 (patch) | |
tree | bc790b1b8a344ddb45e48ee8aeed116793560f23 | |
parent | 63f35e7af729bb6569a4759087a8781a11454963 (diff) |
Use `slice::iter` instead of `into_iter` to avoid future breakage
`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.
-rw-r--r-- | src/and_then.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/and_then.rs b/src/and_then.rs index 6b740a3..36f6938 100644 --- a/src/and_then.rs +++ b/src/and_then.rs @@ -91,7 +91,7 @@ fn test_and_then_ok() { use std::str::FromStr; let mapped: Vec<_> = ["1", "2", "a", "b", "4", "5"] - .into_iter() + .iter() .map(|txt| usize::from_str(txt).map_err(|e| (txt, e))) .and_then_ok(|i| Ok(2 * i)) .and_then_err(|(txt, e)| if txt == &"a" { Ok(15) } else { Err(e) }) |