Skip to content

Commit

Permalink
make Clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
SIGSTACKFAULT committed Apr 18, 2024
1 parent fc09a8b commit 7652549
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/hex/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ impl Hex {
/// assert_eq!(Hex::from_u64(x), Hex::new(0xAA, -0xBB));
/// ```
#[inline]
#[must_use]
#[doc(alias = "unpack")]
pub fn from_u64(value: u64) -> Self {
pub const fn from_u64(value: u64) -> Self {
let x = (value >> 32) as i32;
let y = (value & 0xFFFF_FFFF) as i32;
Self::new(x, y)
Expand All @@ -92,8 +93,10 @@ impl Hex {
/// assert_eq!(x, 0x000000AA_FFFFFF45u64);
/// ```
#[inline]
#[must_use]
#[allow(clippy::cast_sign_loss)]
#[doc(alias = "pack")]
pub fn as_u64(self) -> u64 {
pub const fn as_u64(self) -> u64 {
let high = (self.x as u32 as u64) << 32;
let low = self.y as u32 as u64;
high | low
Expand Down

0 comments on commit 7652549

Please sign in to comment.