Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 17e238d

Browse files
gilescopem-ou-se
andauthored
Use wrapping sub
Co-authored-by: Mara <m-ou.se@m-ou.se>
1 parent 845c14d commit 17e238d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/char/methods.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl char {
337337
// the `radix` is constant and 10 or smaller
338338
let val = if likely(radix <= 10) {
339339
// If not a digit, a number greater than radix will be created.
340-
self as u32 ^ ASCII_DIGIT_MASK
340+
(self as u32).wrapping_sub('0' as u32)
341341
} else {
342342
match self {
343343
'0'..='9' => self as u32 - '0' as u32,

0 commit comments

Comments
 (0)