Skip to content

Wrong suggestion in search_is_some lint #4453

Closed
@flip1995

Description

@flip1995

It's pretty much the same as #4033. The closure argument of any needs one dereference less than the closure argument of find.

fn main() {
    let vec = vec![1];
    let _ = vec.iter().find(|x| **x == 0).is_some();
    // let _ = vec.iter().any(|x| **x == 0); // <- this is suggested
    let _ = vec.iter().any(|x| *x == 0); // <- this should be suggested
}

Playground

Originally posted by @BO41 in #4436 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesL-suggestionLint: Improving, adding or fixing lint suggestionsgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions