Skip to content

Commit 3d0b981

Browse files
committed
Add parentheses for clarity
1 parent 3096301 commit 3d0b981

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

time/src/date.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ impl Date {
9191
Self {
9292
// Safety: `ordinal` is not zero.
9393
value: unsafe {
94-
NonZeroI32::new_unchecked(year << 10 | (is_leap_year as i32) << 9 | ordinal as i32)
94+
NonZeroI32::new_unchecked(
95+
(year << 10) | ((is_leap_year as i32) << 9) | ordinal as i32,
96+
)
9597
},
9698
}
9799
}
@@ -325,7 +327,7 @@ impl Date {
325327
/// This method is optimized to take advantage of the fact that the value is pre-computed upon
326328
/// construction and stored in the bitpacked struct.
327329
const fn is_in_leap_year(self) -> bool {
328-
self.value.get() >> 9 & 1 == 1
330+
(self.value.get() >> 9) & 1 == 1
329331
}
330332

331333
/// Get the year of the date.

time/src/month.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl Month {
8080
28
8181
}
8282
} else {
83-
30 | val ^ val >> 3
83+
30 | val ^ (val >> 3)
8484
}
8585
}
8686

0 commit comments

Comments
 (0)