Skip to content

Commit bf02d1e

Browse files
committed
No need to check the assert all the time.
1 parent d9b3ff7 commit bf02d1e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/char/methods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,10 @@ impl char {
343343
without modifying the original"]
344344
#[inline]
345345
pub const fn to_digit(self, radix: u32) -> Option<u32> {
346-
assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
347346
// If not a digit, a number greater than radix will be created.
348347
let mut digit = (self as u32).wrapping_sub('0' as u32);
349348
if radix > 10 {
349+
assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
350350
if digit < 10 {
351351
return Some(digit);
352352
}

0 commit comments

Comments
 (0)