Skip to content

Commit 7983713

Browse files
committed
don't turn off inlay hints - reword advice into different section based on Andrei's feedback
1 parent 56c213d commit 7983713

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

exercise-book/src/iterators.md

+7-3
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,15 @@ let z = x.iter().zip(y.iter())
136136

137137
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.
138138

139+
## Iterator chains workflow advice
140+
141+
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.
142+
143+
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.
144+
139145
## Step-by-Step-Solution
140146

141-
⚠️ NOTICE! ⚠️
147+
⚠️ NOTICE! ⚠️
142148

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

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

151157
🧘 END OF NOTICE 🧘
152158

153-
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`.
154-
155159
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.
156160

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

0 commit comments

Comments
 (0)