mirror of
https://github.com/chronotope/chrono.git
synced 2025-10-02 15:26:12 +00:00
Apply suggestions for clippy 1.68
This commit is contained in:
parent
daa86a77d3
commit
9d376499b1
@ -48,7 +48,7 @@ pub(super) fn number(s: &str, min: usize, max: usize) -> ParseResult<(&str, i64)
|
|||||||
let mut n = 0i64;
|
let mut n = 0i64;
|
||||||
for (i, c) in bytes.iter().take(max).cloned().enumerate() {
|
for (i, c) in bytes.iter().take(max).cloned().enumerate() {
|
||||||
// cloned() = copied()
|
// cloned() = copied()
|
||||||
if !(b'0'..=b'9').contains(&c) {
|
if !c.is_ascii_digit() {
|
||||||
if i < min {
|
if i < min {
|
||||||
return Err(INVALID);
|
return Err(INVALID);
|
||||||
} else {
|
} else {
|
||||||
@ -79,7 +79,7 @@ pub(super) fn nanosecond(s: &str) -> ParseResult<(&str, i64)> {
|
|||||||
let v = v.checked_mul(SCALE[consumed]).ok_or(OUT_OF_RANGE)?;
|
let v = v.checked_mul(SCALE[consumed]).ok_or(OUT_OF_RANGE)?;
|
||||||
|
|
||||||
// if there are more than 9 digits, skip next digits.
|
// if there are more than 9 digits, skip next digits.
|
||||||
let s = s.trim_left_matches(|c: char| ('0'..='9').contains(&c));
|
let s = s.trim_left_matches(|c: char| c.is_ascii_digit());
|
||||||
|
|
||||||
Ok((s, v))
|
Ok((s, v))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user