Ask your AI Ask your AI to turn this code into a guided bug-finding exercise.
Claude ChatGPT I am reading "What happens when code constructs values.iter().map(transform) but never uses the returned iterator?" on CodeWiki (https://codewiki.com/practice/mcq/rust/iterators/adapter-needs-consumer/).
Context (verbatim from the page):
"""
What happens when code constructs values.iter().map(transform) but never uses the returned iterator?
The adapter is created, but transform is not called.
transform runs immediately for every value.
Rust automatically collects the results into a Vec.
The source collection is always consumed.
"""
Introduce three subtle bugs into the example above and let me find them. Reveal each answer only after I have guessed.
Answer in English. Keep code examples in Rust. Where you are unsure, say so.