diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-17 00:07:28 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-17 00:07:28 +0200 |
| commit | b47265e65866cf94ee3bb82908bbc5138ed1f5a7 (patch) | |
| tree | a3b5c2701431babb819d2862a4b942bc12392087 | |
| parent | 13d3d0e856012b0ddb7924787a5c7e78f5bf5d03 (diff) | |
| parent | bf02d1ea5ff52c26db8c13d80bc142de53b65e76 (diff) | |
Rollup merge of #96124 - gilescope:to_digit_speedup4, r=thomcc
to_digit tweak No need to check the assert all the time. (Checked the TODO and it's not time to get rid of it yet)
| -rw-r--r-- | library/core/src/char/methods.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index 5809ed1f33b..0bec38a877e 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -343,10 +343,10 @@ impl char { without modifying the original"] #[inline] pub const fn to_digit(self, radix: u32) -> Option<u32> { - assert!(radix <= 36, "to_digit: radix is too high (maximum 36)"); // If not a digit, a number greater than radix will be created. let mut digit = (self as u32).wrapping_sub('0' as u32); if radix > 10 { + assert!(radix <= 36, "to_digit: radix is too high (maximum 36)"); if digit < 10 { return Some(digit); } |
