-
-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplify date parser #4143
base: main
Are you sure you want to change the base?
Simplify date parser #4143
Conversation
6b320c6
to
d82795c
Compare
d82795c
to
161aae5
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4143 +/- ##
==========================================
+ Coverage 47.24% 53.56% +6.31%
==========================================
Files 476 487 +11
Lines 46892 48863 +1971
==========================================
+ Hits 22154 26172 +4018
+ Misses 24738 22691 -2047 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me at a high level. I like the move from char
to u8
ascii. I have a suggestion.
} else { | ||
None | ||
} | ||
}) | ||
} | ||
|
||
fn next_n_digits<const N: usize>(&mut self) -> Option<[u8; N]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Use next_digit
over using next_n_digits
where possible.
As tempting as next_n_digits
is to write, most the lengths should be relatively stable here. We can then also avoid using unsafe code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I put next_digit
in next_n_digits
now because I found Peekable<slice::Iter>
doesn't give the len of slice::Iter
under serveral conditions, so the length check is useless.
But I prefer using next_n_digits
as it is not that noisy here.
84bb6bb
to
3cd4ac0
Compare
2b9a56c
to
6014688
Compare
6014688
to
d430a23
Compare
JsString
is not asciiChar<'_>
withslice::Iter<'_, u8>
next_n_digits
helper method to save calls ofnext_digit