about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTobias Bieniek <tobias.bieniek@gmail.com>2018-11-13 17:49:38 +0100
committerTobias Bieniek <tobias.bieniek@gmail.com>2018-11-13 22:02:51 +0100
commit04aade83f2785d6ca43049ff89026ed930f792f1 (patch)
tree7257098477c482dbc180317efc92416b6c125884 /src
parent98f61a3195663465bc2f65287fbcbe14761fe6a8 (diff)
downloadrust-04aade83f2785d6ca43049ff89026ed930f792f1.tar.gz
rust-04aade83f2785d6ca43049ff89026ed930f792f1.zip
core/char: Replace condition + `panic!()` with `assert!()`
Diffstat (limited to 'src')
-rw-r--r--src/libcore/char/methods.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs
index 35181afea3d..fc212aa4f20 100644
--- a/src/libcore/char/methods.rs
+++ b/src/libcore/char/methods.rs
@@ -121,9 +121,7 @@ impl char {
     #[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,