Skip to content

Commit 04aade8

Browse files
committed
core/char: Replace condition + panic!() with assert!()
1 parent 98f61a3 commit 04aade8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/libcore/char/methods.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,7 @@ impl char {
121121
#[stable(feature = "rust1", since = "1.0.0")]
122122
#[inline]
123123
pub fn to_digit(self, radix: u32) -> Option<u32> {
124-
if radix > 36 {
125-
panic!("to_digit: radix is too high (maximum 36)");
126-
}
124+
assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
127125
let val = match self {
128126
'0' ..= '9' => self as u32 - '0' as u32,
129127
'a' ..= 'z' => self as u32 - 'a' as u32 + 10,

0 commit comments

Comments
 (0)