about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTobias Bieniek <tobias.bieniek@gmail.com>2018-11-14 08:55:53 +0100
committerTobias Bieniek <tobias.bieniek@gmail.com>2018-11-14 08:55:53 +0100
commit64a517265297cc1d4e9e116dcbb06561c063c3d4 (patch)
tree61262af18f1fb7cb62afcd26c7c19acc5bb1c4c7
parent17f08fecfd81479e04fc5ea7590cecdb429c7ce3 (diff)
downloadrust-64a517265297cc1d4e9e116dcbb06561c063c3d4.tar.gz
rust-64a517265297cc1d4e9e116dcbb06561c063c3d4.zip
core/char: Drop `radix == 10` special case
This seems to perform equally well
-rw-r--r--src/libcore/char/methods.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs
index 46b201f7bbf..4207b3c776c 100644
--- a/src/libcore/char/methods.rs
+++ b/src/libcore/char/methods.rs
@@ -122,14 +122,7 @@ impl char {
     #[inline]
     pub fn to_digit(self, radix: u32) -> Option<u32> {
         assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
-        if radix == 10 {
-            return match self {
-                '0' ..= '9' => Some(self as u32 - '0' as u32),
-                _ => None,
-            };
-        }
-
-        let val = if radix < 10  {
+        let val = if radix <= 10  {
             match self {
                 '0' ..= '9' => self as u32 - '0' as u32,
                 _ => return None,