mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-01-23 05:54:59 +02:00
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.
This commit is contained in:
parent
c866c13b68
commit
429694fa63
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user