File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -439,11 +439,11 @@ impl AsciiChar {
439
439
///
440
440
/// Radixes greater than 36 are not supported and will result in a panic.
441
441
#[ must_use]
442
- pub fn is_digit ( self , radix : u32 ) -> bool {
442
+ pub const fn is_digit ( self , radix : u32 ) -> bool {
443
443
match ( self as u8 , radix) {
444
- ( b'0' ..=b'9' , 0 ..=36 ) => u32 :: from ( self as u8 - b '0') < radix,
445
- ( b'a' ..=b'z' , 11 ..=36 ) => u32 :: from ( self as u8 - b 'a') < radix - 10 ,
446
- ( b'A' ..=b'Z' , 11 ..=36 ) => u32 :: from ( self as u8 - b 'A') < radix - 10 ,
444
+ ( b'0' ..=b'9' , 0 ..=36 ) => ( self as u32 - '0' as u32 ) < radix,
445
+ ( b'a' ..=b'z' , 11 ..=36 ) => ( self as u32 - 'a' as u32 ) < radix - 10 ,
446
+ ( b'A' ..=b'Z' , 11 ..=36 ) => ( self as u32 - 'A' as u32 ) < radix - 10 ,
447
447
( _, 0 ..=36 ) => false ,
448
448
( _, _) => panic ! ( "radixes greater than 36 are not supported" ) ,
449
449
}
You can’t perform that action at this time.
0 commit comments