diff options
Diffstat (limited to 'exercises/vecs/vecs2.rs')
| -rw-r--r-- | exercises/vecs/vecs2.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/exercises/vecs/vecs2.rs b/exercises/vecs/vecs2.rs index 5bea09a..d016daa 100644 --- a/exercises/vecs/vecs2.rs +++ b/exercises/vecs/vecs2.rs @@ -6,13 +6,11 @@ // // Execute `rustlings hint vecs2` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE - fn vec_loop(mut v: Vec<i32>) -> Vec<i32> { for i in v.iter_mut() { // TODO: Fill this up so that each element in the Vec `v` is // multiplied by 2. - ??? + *i *= 2; } // At this point, `v` should be equal to [4, 8, 12, 16, 20]. @@ -23,7 +21,7 @@ fn vec_map(v: &Vec<i32>) -> Vec<i32> { v.iter().map(|num| { // TODO: Do the same thing as above - but instead of mutating the // Vec, you can just return the new number! - ??? + num * 2 }).collect() } |
