Skip to content

Commit

Permalink
don't turn off inlay hints - reword advice into different section bas…
Browse files Browse the repository at this point in the history
…ed on Andrei's feedback
  • Loading branch information
miguelraz committed Jan 20, 2025
1 parent 56c213d commit 7983713
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions exercise-book/src/iterators.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,15 @@ let z = x.iter().zip(y.iter())

where the `.map(|(a, b)| a + b)` is iterating over `[(10, 1), (20, 2), (30, 3)]` and calling the left argument `a` and the right argument `b`, in each iteration.

## Iterator chains workflow advice

Start every iterator call on a new line, so that you can see closure arguments and type hints for the iterator at the end of the line clearly.

When in doubt, write `.map(|x| x)` first to see what item types you get and decide on what iterator methods to use and what to do inside a closure based on that.

## Step-by-Step-Solution

⚠️ NOTICE! ⚠️
⚠️ NOTICE! ⚠️

When starting out with iterators, it's very easy to be "led astray" by doing what is locally useful as suggested by the compiler.

Expand All @@ -150,8 +156,6 @@ You, unfortunately, relive similar experiences when learning Rust without knowin

🧘 END OF NOTICE 🧘

We highly recommend that you consider turning off `inlay hints` in your `rust-analyzer` settings to `offUnlessPressed`, as they can get very noisy very quickly. You can do this by searching for `inlay hints` and choosing the right option in `Settings > Editor > Inlay Hints > Enabled`.

In general, we also recommend using the Rust documentation to get unstuck. In particular, look for the examples in the [Iterator](https://doc.rust-lang.org/stable/std/iter/trait.Iterator.html) page of the standard library for this exercise.

If you ever feel completely stuck or that you haven’t understood something, please hail the trainers quickly.
Expand Down

0 comments on commit 7983713

Please sign in to comment.