-
-
Notifications
You must be signed in to change notification settings - Fork 255
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
Implement Weekday::nth_next
#544
Conversation
Codecov Report
@@ Coverage Diff @@
## main #544 +/- ##
=======================================
+ Coverage 95.3% 95.7% +0.5%
=======================================
Files 78 79 +1
Lines 8563 8780 +217
=======================================
+ Hits 8157 8406 +249
+ Misses 406 374 -32
... and 36 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I don't think I know what to do with those seemingly unrelated Clippy errors 😓 |
Don't worry about clippy. That's a side effect of there being a Rust release yesterday that includes new lints. However, code coverage is also failing, so presumably some more tests are needed. |
Hmm, it's asking to cover an unreachable case. Wish there was a way to construct the enum from a raw u8 without bringing a whole extra package. |
Alright. I'll have a concrete suggestion when I get to reviewing the code. |
f99c6a3
to
8dca98c
Compare
@Kinrany Would you mind addressing the requested changes above? Otherwise I'll likely end up implementing the request myself. |
Sorry @jhpratt. Other things keep taking priority. I should be able to find a moment to do it eventually, but I wouldn't mind at all if you did reimplement it. I don't care about authorship, this is just something I wanted to have in the library. Thank you for the hard work of maintaining the package, you rule 😄 |
Up to you! I don't have a release planned for anything else at the moment, so it's not like there's a big rush. |
b9c3eee
to
4507d07
Compare
Thank you! |
Adds
Weekday::nth
, afn(Weekday, u8) -> Weekday
method.This is similar to
Iterator::nth
: it returns the n-th next week day after the current one.This is in place of four different methods with long names that would be opposites of
number_from_monday
,number_from_sunday
,num_days_from_monday
,num_days_from_sunday
. I was bikeshedding the names in my mind and realized that making a single general method is likely more ergonomic, if only because of the amount of effort it was taking to write - and therefore understand - the fairly long descriptions of each method.Closes #542