- Remove mut from the closure declaration line. Why does that make compilation fail?
Solution: Because the closure becomes mutable when values it captures are mutated inside it, even when (like in our example) all of those values have copy semantics.
- Remove move from the closure declaration line. What's the effect and why?
Solution: The closure turns into having the default borrow semantics, which means that it receives a borrowing of the outer_scope_x variable, instead of a copy of it.
- It looks like we wouldn't need the block starting from line 4 and ending on line 11. Try to remove that and see if that's true.
Solution: We actually don't! The last println! wants access to outer_scope_x, which is being borrowed mutably by the ...