-
Notifications
You must be signed in to change notification settings - Fork 541
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
Make methods on NaiveDateTime
const where possible
#1286
Conversation
Codecov Report
@@ Coverage Diff @@
## 0.4.x #1286 +/- ##
==========================================
+ Coverage 91.53% 91.55% +0.01%
==========================================
Files 38 38
Lines 17325 17352 +27
==========================================
+ Hits 15859 15886 +27
Misses 1466 1466
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
9043fa4
to
5f50ab5
Compare
The CI pointed out an issue because of our MSRV:
I have added a workaround so that we can have at least one constructor for a |
5f50ab5
to
cdced86
Compare
cdced86
to
13bc8f4
Compare
955db54
to
ba8604c
Compare
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 great.
@@ -1455,6 +1462,22 @@ impl NaiveDate { | |||
self.of().weekday() | |||
} | |||
|
|||
/// Counts the days in the proleptic Gregorian calendar, with January 1, Year 1 (CE) as day 1. |
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.
Just a fun recommendation: link to the meaning of "AD 1":
/// ... with January 1, Year 1 (CE) as day 1, i.e. [AD 1](https://en.wikipedia.org/wiki/AD_1)
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.
Please squash the first three commits into the fourth one: they add code that goes unused.
Make methods on `NaiveDateTime` const where possible
ba8604c
to
6b3a314
Compare
I had to copy a few methods from the
Datelike
andTimelike
traits to const methods onNaiveDate
andNaiveTime
, to make use of them in const methods onNaiveDateTime
.Otherwise the changes are fairly straightforward.
Only
DateTime<Tz>
to go after this (and a handful of methods that depend onDuration
).