Skip to content

lint vec.clone().into_iter().stuff().collect() to suggest vec.iter().stuff().cloned().collect() #3302

Open
@oli-obk

Description

@oli-obk

Found the following code in the wild

 let w: Vec<String> = vec_of_string
        .clone()
        .into_iter()
        .filter(|s| s.len() < 10)
        .collect();

Not sure what other things should be linted, but at least filter and filter_map after a clone+into_iter

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-complexityLint: Belongs in the complexity lint groupL-perfLint: Belongs in the perf lint group

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions