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

Lint: is_ascii_digit instead of is_digit #6399

Closed
camsteffen opened this issue Nov 28, 2020 · 5 comments · Fixed by #8624
Closed

Lint: is_ascii_digit instead of is_digit #6399

camsteffen opened this issue Nov 28, 2020 · 5 comments · Fixed by #8624
Assignees
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy

Comments

@camsteffen
Copy link
Contributor

camsteffen commented Nov 28, 2020

What it does

Finds usages of is_digit that can be replaced with is_ascii_digit or is_ascii_hexdigit.

Categories (optional)

  • Kind: style

It is simpler since the radix does not need to be specified.

Drawbacks

None.

Example

fn bad(c: char) {
    c.is_digit(10);
    c.is_digit(16);
}

Could be written as:

fn good(c: char) {
    c.is_ascii_digit();
    c.is_ascii_hexdigit();
}
@camsteffen camsteffen added the A-lint Area: New lints label Nov 28, 2020
@flip1995 flip1995 added the good-first-issue These issues are a good way to get started with Clippy label Nov 29, 2020
@rajcspsg
Copy link

can I work on this issue?

@camsteffen
Copy link
Contributor Author

@rajcspsg go for it!

bengsparks added a commit to bengsparks/rust-clippy that referenced this issue Dec 24, 2020
bengsparks added a commit to bengsparks/rust-clippy that referenced this issue Dec 24, 2020
@bengsparks
Copy link
Contributor

@camsteffen
This issue seems to not have made much progress.
Can I submit my solution instead?

@camsteffen
Copy link
Contributor Author

I think @rajcspsg is still working on this at #6400.

@pitaj
Copy link
Contributor

pitaj commented Apr 2, 2022

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints 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.

5 participants