Skip to content

iter() -> into_iter() #7459

@tschuett

Description

@tschuett

What it does

Propose to change iter() to into_iter()

Categories (optional)

What is the advantage of the recommended code over the original code

For example:

My old code:
foo.unwrap_or_default().iter()....
By hand I changed it to:
foo.unwrap_or_default().into_iter()....
Then clippy proposed to remove some clone()s
When I removed the clone()s, clippy proposed to change filter + map to filter_map
clippy is awesome. The code looks beautiful now.

The suggestion to change iter() to into_iter() was missing and blocking the other lints

Drawbacks

None.

Example

foo.unwrap_or_default().iter()....

Could be written as:

foo.unwrap_or_default().into_iter()....

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions