mirror of
https://github.com/chronotope/chrono.git
synced 2025-09-26 20:40:51 +00:00
Apply suggestions from clippy 1.85
This commit is contained in:
parent
15e287b4fb
commit
11d227a22b
@ -1142,7 +1142,7 @@ impl NaiveDate {
|
||||
let mut years = self.year() - base.year();
|
||||
// Comparing tuples is not (yet) possible in const context. Instead we combine month and
|
||||
// day into one `u32` for easy comparison.
|
||||
if (self.month() << 5 | self.day()) < (base.month() << 5 | base.day()) {
|
||||
if ((self.month() << 5) | self.day()) < ((base.month() << 5) | base.day()) {
|
||||
years -= 1;
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ fn test_date_from_yo() {
|
||||
assert_eq!(from_yo(2012, 300), Some(ymd(2012, 10, 26)));
|
||||
assert_eq!(from_yo(2012, 366), Some(ymd(2012, 12, 31)));
|
||||
assert_eq!(from_yo(2012, 367), None);
|
||||
assert_eq!(from_yo(2012, 1 << 28 | 60), None);
|
||||
assert_eq!(from_yo(2012, (1 << 28) | 60), None);
|
||||
|
||||
assert_eq!(from_yo(2014, 0), None);
|
||||
assert_eq!(from_yo(2014, 1), Some(ymd(2014, 1, 1)));
|
||||
@ -406,7 +406,7 @@ fn test_date_with_ordinal() {
|
||||
assert_eq!(d.with_ordinal(61), Some(NaiveDate::from_ymd_opt(2000, 3, 1).unwrap()));
|
||||
assert_eq!(d.with_ordinal(366), Some(NaiveDate::from_ymd_opt(2000, 12, 31).unwrap()));
|
||||
assert_eq!(d.with_ordinal(367), None);
|
||||
assert_eq!(d.with_ordinal(1 << 28 | 60), None);
|
||||
assert_eq!(d.with_ordinal((1 << 28) | 60), None);
|
||||
let d = NaiveDate::from_ymd_opt(1999, 5, 5).unwrap();
|
||||
assert_eq!(d.with_ordinal(366), None);
|
||||
assert_eq!(d.with_ordinal(u32::MAX), None);
|
||||
|
Loading…
x
Reference in New Issue
Block a user