Skip to content

Commit 64a5172

Browse files
committed
core/char: Drop radix == 10 special case
This seems to perform equally well
1 parent 17f08fe commit 64a5172

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

Diff for: src/libcore/char/methods.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,7 @@ impl char {
122122
#[inline]
123123
pub fn to_digit(self, radix: u32) -> Option<u32> {
124124
assert!(radix <= 36, "to_digit: radix is too high (maximum 36)");
125-
if radix == 10 {
126-
return match self {
127-
'0' ..= '9' => Some(self as u32 - '0' as u32),
128-
_ => None,
129-
};
130-
}
131-
132-
let val = if radix < 10 {
125+
let val = if radix <= 10 {
133126
match self {
134127
'0' ..= '9' => self as u32 - '0' as u32,
135128
_ => return None,

0 commit comments

Comments
 (0)