Skip to content

Commit

Permalink
Tweak solution to iter exercise (#1884)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
fw-immunant authored Mar 6, 2024
1 parent c866c13 commit 429694f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/iterators/exercise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 429694f

Please sign in to comment.