Skip to content

map_clone can lead to compile error, suggest removing the map instead #498

Closed
@leoyvens

Description

@leoyvens

The following code
std::env::args().map(|v| v.clone())
will trigger map_clone, suggesting
std::env::args().cloned()
But that dosen't compile, the correct suggestion would be to remove the map(|v| v.clone()) or the .cloned() call entirely, since the iterator already passes things by value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions