feat: improved closure docs and exercises by using into_iter()

This commit is contained in:
jayber 2022-06-07 13:47:44 +01:00
parent 3712439caf
commit 2fd0e53365

View File

@ -23,6 +23,7 @@ fn sum_letters(animals: &Vec<&str>) -> usize {
// https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.fold // https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html#method.fold
// and the return types of the different ways of getting an iterator // and the return types of the different ways of getting an iterator
// https://doc.rust-lang.org/stable/std/iter/ // https://doc.rust-lang.org/stable/std/iter/
// https://doc.rust-lang.org/std/iter/index.html#the-three-forms-of-iteration
// https://doc.rust-lang.org/std/iter/trait.IntoIterator.html#tymethod.into_iter // https://doc.rust-lang.org/std/iter/trait.IntoIterator.html#tymethod.into_iter
// TODO: change the next 2 lines to compile and pass the test. // TODO: change the next 2 lines to compile and pass the test.
let sum_closure = |x: &usize, y: &usize| &(x + y); let sum_closure = |x: &usize, y: &usize| &(x + y);