Skip to content

Commit

Permalink
Tweak solution to iter exercise
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
  • Loading branch information
fw-immunant committed Mar 6, 2024
1 parent 9b57c48 commit 214146d
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 214146d

Please sign in to comment.