Skip to content

Commit

Permalink
Merge pull request #11 from nyris/feature/clippy-fixes
Browse files Browse the repository at this point in the history
Fix code style as indicated by Clippy
  • Loading branch information
sunsided authored May 14, 2024
2 parents 3a36393 + 3595c6b commit a9e1705
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl ShortGuid {
/// Creates a [`ShortGuid`] using the supplied bytes.
#[inline]
pub fn from_slice<B: AsRef<[u8]>>(bytes: B) -> Result<Self, ParseError> {
let uuid = Uuid::from_slice(bytes.as_ref()).map_err(|e| ParseError::InvalidSlice(e))?;
let uuid = Uuid::from_slice(bytes.as_ref()).map_err(ParseError::InvalidSlice)?;
Ok(Self(uuid))
}

Expand All @@ -124,7 +124,7 @@ impl ShortGuid {
/// instead.
#[inline]
pub fn from_bytes<B: Borrow<[u8; 16]>>(bytes: B) -> Self {
Self(Uuid::from_bytes_ref(bytes.borrow()).clone())
Self(*Uuid::from_bytes_ref(bytes.borrow()))
}

/// Constructs a [`ShortGuid`] instance based on a byte slice of bytes ordered in little endian.
Expand Down Expand Up @@ -153,7 +153,7 @@ impl ShortGuid {
/// ```
#[inline]
pub fn from_bytes_le<B: Borrow<[u8; 16]>>(bytes: B) -> Self {
Self(Uuid::from_bytes_le(bytes.borrow().clone()))
Self(Uuid::from_bytes_le(*bytes.borrow()))
}

/// Returns a slice of 16 octets containing the value.
Expand Down Expand Up @@ -310,15 +310,15 @@ impl Debug for ShortGuid {
write!(
f,
"{short} ({long})",
short = Self::encode(&self.0),
short = Self::encode(self.0),
long = self.0
)
}
}

impl Display for ShortGuid {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{short}", short = Self::encode(&self.0))
write!(f, "{short}", short = Self::encode(self.0))
}
}

Expand Down

0 comments on commit a9e1705

Please sign in to comment.