We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 78e2206 commit ec09d7fCopy full SHA for ec09d7f
library/core/src/num/dec2flt/parse.rs
@@ -80,11 +80,8 @@ pub fn parse_decimal(s: &str) -> ParseResult<'_> {
80
81
/// Carves off decimal digits up to the first non-digit character.
82
fn eat_digits(s: &[u8]) -> (&[u8], &[u8]) {
83
- let mut i = 0;
84
- while i < s.len() && b'0' <= s[i] && s[i] <= b'9' {
85
- i += 1;
86
- }
87
- (&s[..i], &s[i..])
+ let pos = s.iter().position(|c| !c.is_ascii_digit()).unwrap_or(s.len());
+ s.split_at(pos)
88
}
89
90
/// Exponent extraction and error checking.
0 commit comments