RS.CLIPPY.TO_DIGIT_IS_SOME
`char.is_digit()` is clearer
This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: to_digit_is_some. Copyright ©2025 The Rust Team. All rights reserved.
What it does
Checks for .to_digit(..).is_some() on chars.
Why is this bad?
This is a convoluted way of checking if a char is a digit. It's
more straight forward to use the dedicated is_digit method.
Example
let is_digit = c.to_digit(radix).is_some();
can be written as:
let is_digit = c.is_digit(radix);
Configuration
-
msrv: The minimum rust version that the project supports. Defaults to therust-versionfield inCargo.toml(default:
current version)