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