Rust

Rust

By DeepSource

Found usage of `.is_digit(..)` with known radixRS-W1038

Anti-pattern
Has Autofix

This issue is raised on .is_digit(10) or .is_digit(16). Consider using the following alternatives:

  • .is_digit(10) can be replaced by .is_ascii_digit()
  • .is_digit(16) can be replaced by .is_ascii_hexdigit()

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();