Skip to content

Commit

Permalink
Add parentheses for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
jhpratt committed Mar 4, 2025
1 parent 3096301 commit 3d0b981
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions time/src/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ impl Date {
Self {
// Safety: `ordinal` is not zero.
value: unsafe {
NonZeroI32::new_unchecked(year << 10 | (is_leap_year as i32) << 9 | ordinal as i32)
NonZeroI32::new_unchecked(
(year << 10) | ((is_leap_year as i32) << 9) | ordinal as i32,
)
},
}
}
Expand Down Expand Up @@ -325,7 +327,7 @@ impl Date {
/// This method is optimized to take advantage of the fact that the value is pre-computed upon
/// construction and stored in the bitpacked struct.
const fn is_in_leap_year(self) -> bool {
self.value.get() >> 9 & 1 == 1
(self.value.get() >> 9) & 1 == 1
}

/// Get the year of the date.
Expand Down
2 changes: 1 addition & 1 deletion time/src/month.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Month {
28
}
} else {
30 | val ^ val >> 3
30 | val ^ (val >> 3)
}
}

Expand Down

0 comments on commit 3d0b981

Please sign in to comment.