From 8cb5cba7750a95336a2394c137b2e07202e30da3 Mon Sep 17 00:00:00 2001 From: "J.c" Date: Sat, 8 Apr 2023 10:50:50 +0200 Subject: [PATCH] docs(vecs2): update hints --- info.toml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/info.toml b/info.toml index 28f9bb31..8f391bae 100644 --- a/info.toml +++ b/info.toml @@ -260,15 +260,14 @@ name = "vecs2" path = "exercises/vecs/vecs2.rs" mode = "test" hint = """ -Hint 1: `i` is each element from the Vec as they are being iterated. Can you try -multiplying this? +In the first function we are looping over the Vector and getting a reference to one `element` at a time. +To modify the value of that `element` we need to use the * dereference operator. You can learn more in this chapter of the Rust book: +https://doc.rust-lang.org/stable/book/ch08-01-vectors.html#iterating-over-the-values-in-a-vector -Hint 2: For the first function, there's a way to directly access the numbers stored -in the Vec, using the * dereference operator. You can both access and write to the -number that way. +In the second function this dereferencing is not necessary, because the map function expects the new value to be returned. -After you've completed both functions, decide for yourself which approach you like -better. What do you think is the more commonly used pattern under Rust developers? +After you've completed both functions, decide for yourself which approach you like better. +What do you think is the more commonly used pattern under Rust developers? """ # MOVE SEMANTICS