Rust

Rust

By DeepSource

Found usage of .is_digit(..) with known radix RS-W1038

Anti-pattern
Autofix

The standard library contains shorthand methods for .is_digit(10) and .is_digit(16); is_ascii_digit and is_ascii_hexdigit respectively.

Prefer using the shorthand methods instead. As of 1.60 (April 2022), there is no shorthand for octal digits.

Examples

Bad practice

'7'.is_digit(10);
'a'.is_digit(16);

Recommended

'7'.is_ascii_digit();
'a'.is_ascii_hexdigit();