Skip to content

search_is_some incorrect text #11681

@xNxExOx

Description

@xNxExOx

Summary

Help suggestion is wrong.
It say to use any instead of any, but the code does not contains any.

Reproducer

I tried this code:

 let _ = [1, 2, 3].iter().find(|x| **x == 3).is_some();

I expected to see this happen:
I did not really think about using any, so I did not expect an warning.

Instead, this happened:

warning: called `is_some()` after searching an `Iterator` with `find`
 --> src/main.rs:4:30
  |
4 |     let _ = [1, 2, 3].iter().find(|x| **x == 3).is_some();
  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `any()` instead: `any(|x| *x == 3)`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
  = note: `#[warn(clippy::search_is_some)]` on by default

Version

rustc 1.72.0 (5680fa18f 2023-08-23)
binary: rustc
commit-hash: 5680fa18feaa87f3ff04063800aec256c3d4b4be
commit-date: 2023-08-23
host: x86_64-pc-windows-msvc
release: 1.72.0
LLVM version: 16.0.5

Additional Labels

No response

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