about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGiles Cope <gilescope@gmail.com>2022-04-16 19:30:23 +0100
committerGiles Cope <gilescope@gmail.com>2022-04-16 19:30:23 +0100
commitbf02d1ea5ff52c26db8c13d80bc142de53b65e76 (patch)
tree38fc2b23db168750459fba923b9ea2cb7aa8879f
parentd9b3ff7d34335c5bc0b2afed640b65d64a85fe03 (diff)
downloadrust-bf02d1ea5ff52c26db8c13d80bc142de53b65e76.tar.gz
rust-bf02d1ea5ff52c26db8c13d80bc142de53b65e76.zip
No need to check the assert all the time.
-rw-r--r--library/core/src/char/methods.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs
index 5809ed1f33b..0bec38a877e 100644
--- a/library/core/src/char/methods.rs
+++ b/library/core/src/char/methods.rs
@@ -343,10 +343,10 @@ impl char {
                   without modifying the original"]
     #[inline]
     pub const fn to_digit(self, radix: u32) -> Option<u32> {
-        assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
         // If not a digit, a number greater than radix will be created.
         let mut digit = (self as u32).wrapping_sub('0' as u32);
         if radix > 10 {
+            assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
             if digit < 10 {
                 return Some(digit);
             }