Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix code style as indicated by Clippy #11

Merged
merged 1 commit into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! # shortguid
//!
//!
//! Provides short, URL-safe UUID representations.
//!
//! ```
Expand Down 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
Loading