Skip to content

Commit 11d227a

Browse files
committed
Apply suggestions from clippy 1.85
1 parent 15e287b commit 11d227a

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/naive/date/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1142,7 +1142,7 @@ impl NaiveDate {
11421142
let mut years = self.year() - base.year();
11431143
// Comparing tuples is not (yet) possible in const context. Instead we combine month and
11441144
// day into one `u32` for easy comparison.
1145-
if (self.month() << 5 | self.day()) < (base.month() << 5 | base.day()) {
1145+
if ((self.month() << 5) | self.day()) < ((base.month() << 5) | base.day()) {
11461146
years -= 1;
11471147
}
11481148

src/naive/date/tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn test_date_from_yo() {
181181
assert_eq!(from_yo(2012, 300), Some(ymd(2012, 10, 26)));
182182
assert_eq!(from_yo(2012, 366), Some(ymd(2012, 12, 31)));
183183
assert_eq!(from_yo(2012, 367), None);
184-
assert_eq!(from_yo(2012, 1 << 28 | 60), None);
184+
assert_eq!(from_yo(2012, (1 << 28) | 60), None);
185185

186186
assert_eq!(from_yo(2014, 0), None);
187187
assert_eq!(from_yo(2014, 1), Some(ymd(2014, 1, 1)));
@@ -406,7 +406,7 @@ fn test_date_with_ordinal() {
406406
assert_eq!(d.with_ordinal(61), Some(NaiveDate::from_ymd_opt(2000, 3, 1).unwrap()));
407407
assert_eq!(d.with_ordinal(366), Some(NaiveDate::from_ymd_opt(2000, 12, 31).unwrap()));
408408
assert_eq!(d.with_ordinal(367), None);
409-
assert_eq!(d.with_ordinal(1 << 28 | 60), None);
409+
assert_eq!(d.with_ordinal((1 << 28) | 60), None);
410410
let d = NaiveDate::from_ymd_opt(1999, 5, 5).unwrap();
411411
assert_eq!(d.with_ordinal(366), None);
412412
assert_eq!(d.with_ordinal(u32::MAX), None);

0 commit comments

Comments
 (0)