We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 090dac0 + b70428b commit f1c47c7Copy full SHA for f1c47c7
library/core/src/char/methods.rs
@@ -330,8 +330,6 @@ impl char {
330
#[stable(feature = "rust1", since = "1.0.0")]
331
#[inline]
332
pub fn to_digit(self, radix: u32) -> Option<u32> {
333
- assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
334
-
335
// the code is split up here to improve execution speed for cases where
336
// the `radix` is constant and 10 or smaller
337
let val = if radix <= 10 {
@@ -340,6 +338,8 @@ impl char {
340
338
_ => return None,
341
339
}
342
} else {
+ assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
+
343
match self {
344
'0'..='9' => self as u32 - '0' as u32,
345
'a'..='z' => self as u32 - 'a' as u32 + 10,
0 commit comments