Skip to content

Conversation

@Mctursh
Copy link
Contributor

@Mctursh Mctursh commented Nov 13, 2025

Clarify the description of the any function parameters.

Summary

Improved the clarity of the comment explaining Self::Item in the Iterator::any trait example to help readers better understand how the parameter type is determined.

Changes

  • Replaced the potentially confusing phrase "Self::Item states it takes arguments to the closure by value" with a clearer explanation
  • Added concrete examples showing that Self::Item is determined by the iterator type (e.g., &T for .iter(), T for .into_iter())

Motivation

The original comment could be misinterpreted to mean that Self::Item is always an owned value, when in fact it can be a reference type depending on the iterator. This clarification helps readers understand that:

  • The iterator implementation defines what Self::Item is
  • Different iterator methods (.iter(), .into_iter(), .iter_mut()) yield different types
  • The closure parameter type matches whatever Self::Item is for that specific iterator

Clarify the description of the `any` function parameters.
@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2025

r? @marioidival

rustbot has assigned @marioidival.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@marioidival marioidival merged commit 9bfb8e3 into rust-lang:master Nov 20, 2025
1 check passed
jhpratt added a commit to jhpratt/rust that referenced this pull request Nov 29, 2025
Update books

## rust-lang/book

2 commits in f78ab89d7545ac17780e6a367055cc089f4cd2ec..8c0eacd5c4acbb650497454f3a58c9e8083202a4
2025-11-18 15:36:41 UTC to 2025-11-18 15:33:41 UTC

- Update ch07-02-defining-modules-to-control-scope-and-privacy.md (rust-lang/book#4570)
- use AND for search terms (rust-lang/book#4573)

## rust-lang/reference

4 commits in f9f1d2a4149f02582aec2f8fcdfa5b596193b4e2..f2ac173df9906de5c03b0ee50653321ef1c4ebe8
2025-11-26 02:52:23 UTC to 2025-11-18 21:54:51 UTC

- document `cfg` conditions on inline assembly templates and operands (rust-lang/reference#2063)
- remove unused "link reference definitions" (rust-lang/reference#2092)
- Add review process overview to review-policy.md (rust-lang/reference#2088)
- Remove restriction on dereferencing pointers in const (rust-lang/reference#2090)

## rust-lang/rust-by-example

5 commits in f944161716230641605b5e3733e1c81f10047fd4..111cfae2f9c3a43f7b0ff8fa68c51cc8f930637c
2025-11-27 20:16:42 UTC to 2025-11-20 21:40:02 UTC

- Use `From::from` fn pointer to convert to boxed errors (rust-lang/rust-by-example#1906)
- link the _tuple_ page instead "TupleStruct" (rust-lang/rust-by-example#1909)
- enum_use.md: avoid an uncommon term (rust-lang/rust-by-example#1976)
- make search less surprising (rust-lang/rust-by-example#1975)
- Update documentation for `any` function in iter_any.md (rust-lang/rust-by-example#1973)
rust-timer added a commit to rust-lang/rust that referenced this pull request Nov 29, 2025
Rollup merge of #149424 - rustbot:docs-update, r=ehuss

Update books

## rust-lang/book

2 commits in f78ab89d7545ac17780e6a367055cc089f4cd2ec..8c0eacd5c4acbb650497454f3a58c9e8083202a4
2025-11-18 15:36:41 UTC to 2025-11-18 15:33:41 UTC

- Update ch07-02-defining-modules-to-control-scope-and-privacy.md (rust-lang/book#4570)
- use AND for search terms (rust-lang/book#4573)

## rust-lang/reference

4 commits in f9f1d2a4149f02582aec2f8fcdfa5b596193b4e2..f2ac173df9906de5c03b0ee50653321ef1c4ebe8
2025-11-26 02:52:23 UTC to 2025-11-18 21:54:51 UTC

- document `cfg` conditions on inline assembly templates and operands (rust-lang/reference#2063)
- remove unused "link reference definitions" (rust-lang/reference#2092)
- Add review process overview to review-policy.md (rust-lang/reference#2088)
- Remove restriction on dereferencing pointers in const (rust-lang/reference#2090)

## rust-lang/rust-by-example

5 commits in f944161716230641605b5e3733e1c81f10047fd4..111cfae2f9c3a43f7b0ff8fa68c51cc8f930637c
2025-11-27 20:16:42 UTC to 2025-11-20 21:40:02 UTC

- Use `From::from` fn pointer to convert to boxed errors (rust-lang/rust-by-example#1906)
- link the _tuple_ page instead "TupleStruct" (rust-lang/rust-by-example#1909)
- enum_use.md: avoid an uncommon term (rust-lang/rust-by-example#1976)
- make search less surprising (rust-lang/rust-by-example#1975)
- Update documentation for `any` function in iter_any.md (rust-lang/rust-by-example#1973)
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.

3 participants