-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
A-lintArea: New lintsArea: New lintsgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy
Description
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
fn foo1(d: u8) -> bool {
(b'0' ..= b'9').contains(&d)
}
Could be written as:
fn foo2(d: u8) -> bool {
d.is_ascii_digit()
}
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsgood first issueThese issues are a good way to get started with ClippyThese issues are a good way to get started with Clippy