mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 02:00:00 +03:00
core/char: Replace condition + panic!() with assert!()
This commit is contained in:
@@ -121,9 +121,7 @@ pub fn is_digit(self, radix: u32) -> bool {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn to_digit(self, radix: u32) -> Option<u32> {
|
||||
if radix > 36 {
|
||||
panic!("to_digit: radix is too high (maximum 36)");
|
||||
}
|
||||
assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
|
||||
let val = match self {
|
||||
'0' ..= '9' => self as u32 - '0' as u32,
|
||||
'a' ..= 'z' => self as u32 - 'a' as u32 + 10,
|
||||
|
||||
Reference in New Issue
Block a user