-
Notifications
You must be signed in to change notification settings - Fork 1.7k
is digits instead of digits range contains #9933
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
Comments
It is supported in https://rust-lang.github.io/rust-clippy/master/#manual_is_ascii_check :) |
Are you sure that lint fires for that foo1 function? I've tried with this and still I don't see anything.
|
Ah, I'm sorry I misunderstood it. The lint only supports for |
This can be an addition to the lint logic. :) @rustbot label +good-first-issue |
@rustbot claim Any hints where I can start?😀 |
Hi @naosense, you can add check for rust-clippy/clippy_lints/src/manual_is_ascii_check.rs Lines 78 to 80 in 1a96571
You may find further informations in the book https://doc.rust-lang.org/nightly/clippy/development/index.html :) |
Hey @naosense you can start, by checking for When starting on a new lint I often first look at the HIR with the As always you're welcome to reach out if you want more guidance. @koka831 already correctly suggested, adding this in the rust-clippy/clippy_lints/src/manual_is_ascii_check.rs file. Mostly to keep all lint logic in one place |
Does anyone use intellj, I configured it as instructed, but it didn't look good, see #9969. Anything wrong? |
improve `manual_is_ascii_check ` check Sorry, not familiar the api, i can only check the method name of expression `<expr-1>.contains(<expr-2>)` after read clippy book and hints from #9933 . i dont know how to check 1. if <expr-1> is a specific range 2. <expr-2> is a character r? `@xFrednet` could you please provide some more hints? 😝️ --- changelog: Enhancement: [`manual_is_ascii_check`]: Now detects ranges with `.contains()` calls [#10053](#10053) <!-- changelog_checked -->
Agreed. Let's close this. |
What it does
It suggests to replace a coding pattern of using range + "contains" with a more specific function.
Lint Name
is_ascii_digit_instead_contains
Category
style
Advantage
Less bug-prone, shorter
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: