Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

search_is_none #6815

Closed
link2xt opened this issue Feb 28, 2021 · 1 comment · Fixed by #6942
Closed

search_is_none #6815

link2xt opened this issue Feb 28, 2021 · 1 comment · Fixed by #6942
Assignees
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy

Comments

@link2xt
Copy link

link2xt commented Feb 28, 2021

What it does

There is already a search_is_some lint.

My suggestion is to add a lint for find(...).is_none(), suggesting to replace with !contains(...). Basically the same as search_is_some, but with negation.

Categories (optional)

  • Kind: clippy::complexity (same as search_is_some)

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

Example

text.find("error").is_none()

Could be written as:

!text.contains("error")
@link2xt link2xt added the A-lint Area: New lints label Feb 28, 2021
@giraffate giraffate added the good-first-issue These issues are a good way to get started with Clippy label Feb 28, 2021
@camsteffen camsteffen added C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages and removed A-lint Area: New lints labels Mar 4, 2021
@mgacek8
Copy link
Contributor

mgacek8 commented Mar 20, 2021

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good-first-issue These issues are a good way to get started with Clippy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants