Skip to content

into_iter_without_iter explanation typo: (&val).iter() vs (&val).into_iter() #11636

Closed
@dtolnay

Description

@dtolnay

Description

The top of https://rust-lang.github.io/rust-clippy/master/index.html#/into_iter_without_iter refers to (&val).iter() whereas (&val).into_iter() is the one that makes sense in context. If val.iter() does not compile, then normally neither would (&val).iter(), so that is not a thing that a user would be forced to write instead of val.iter().

Why is this bad?
It’s not bad, but having them is idiomatic and allows the type to be used in iterator chains by just calling .iter(), instead of the more awkward <&Type>::into_iter or (&val).iter() syntax in case of ambiguity with another Intoiterator impl.

Separately, Intoiterator should be capitalized as IntoIterator.

Version

No response

Additional Labels

@rustbot label +A-documentation

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documentationArea: Adding or improving documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions