Skip to content

docs(ch13-02): fix typo 'iteration' to 'iterator' in filter example (#4705)#4774

Open
Dodothereal wants to merge 1 commit into
rust-lang:mainfrom
Dodothereal:typo/gh-4705-iteration-to-iterator
Open

docs(ch13-02): fix typo 'iteration' to 'iterator' in filter example (#4705)#4774
Dodothereal wants to merge 1 commit into
rust-lang:mainfrom
Dodothereal:typo/gh-4705-iteration-to-iterator

Conversation

@Dodothereal

Copy link
Copy Markdown

Fixes #4705

Summary

In src/ch13-02-iterators.md, the sentence describing the result of filter:

If the closure returns true, the value will be included in the iteration produced by filter.

should read "the iterator produced by filter". filter returns an iterator that lazily yields the chosen items — not an "iteration". The surrounding paragraph already uses "iterator" consistently (e.g. "the closure gets an item from the iterator and returns a bool"), so this single-word fix keeps the terminology aligned.

Test plan

  • Verified the typo exists in the current rendered sentence at https://doc.rust-lang.org/stable/book/ch13-02-iterators.html#closures-that-capture-their-environment.
  • Confirmed grep -n iteration src/ch13-02-iterators.md shows only this one occurrence in the filter example ("the iteration produced by filter"); other uses of "iteration" in the file (e.g. "one iteration of the loop", "when iteration is over", "the iteration behavior that the Iterator trait provides") are correct usages and are intentionally left untouched.
  • Ran dprint fmt src/ch13-02-iterators.md (the formatter the repo uses for Markdown per CONTRIBUTING.md) and confirmed there are no further formatting changes — the single-word fix is already dprint-clean.
  • git diff --stat reports 1 file changed, 1 insertion(+), 1 deletion(-).

AI assistance

Used an AI coding assistant (Claude Code) to identify the affected line, write the patch, and draft this PR description. The change itself is a single-word substitution that I verified by re-reading the affected paragraph and the file's other usages of "iteration" against grep.

Fixes rust-lang#4705

The line "the value will be included in the iteration produced by
filter" should refer to "the iterator produced by filter", matching
the surrounding paragraph's use of "iterator" and matching what
filter actually returns (an iterator that lazily yields the chosen
items).

Verified against the current rendering on the stable book page:
https://doc.rust-lang.org/stable/book/ch13-02-iterators.html#closures-that-capture-their-environment

Only one word is changed. `dprint fmt` reports no further formatting
changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Spell problem in Ch13-2

1 participant