Skip to content

Conversation

@Mctursh
Copy link

@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

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