core/char: Drop radix == 10 special case
This seems to perform equally well
This commit is contained in:
parent
17f08fecfd
commit
64a5172652
1 changed files with 1 additions and 8 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue