Skip to content

Commit

Permalink
Apply suggestions from clippy 1.85
Browse files Browse the repository at this point in the history
  • Loading branch information
djc committed Feb 21, 2025
1 parent 15e287b commit 11d227a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/naive/date/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions src/naive/date/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 11d227a

Please sign in to comment.