From 429694fa638c981b5cb260b79464699e699619f1 Mon Sep 17 00:00:00 2001 From: Frances Wingerter <91758128+fw-immunant@users.noreply.github.com> Date: Wed, 6 Mar 2024 20:18:31 +0000 Subject: [PATCH] Tweak solution to iter exercise (#1884) Because `.zip()` is limited to the shorter length, the `.take()` call here is unnecessary. When explaining this solution I don't want to have to explain a call to a method that, used as it is, does nothing. --- src/iterators/exercise.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/iterators/exercise.rs b/src/iterators/exercise.rs index c3b4a41e860..2d978607334 100644 --- a/src/iterators/exercise.rs +++ b/src/iterators/exercise.rs @@ -27,7 +27,7 @@ where // ANCHOR_END: offset_differences let a = (&values).into_iter(); let b = (&values).into_iter().cycle().skip(offset); - a.zip(b).map(|(a, b)| *b - *a).take(values.len()).collect() + a.zip(b).map(|(a, b)| *b - *a).collect() } // ANCHOR: unit-tests