From 3595c6b05fccfeaa42a6ab8a06ee86e6dba05679 Mon Sep 17 00:00:00 2001 From: Markus Mayer Date: Fri, 10 May 2024 12:00:17 +0200 Subject: [PATCH] Apply code style fixes --- src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index babdc9b..c2583c5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,5 @@ //! # shortguid -//! +//! //! Provides short, URL-safe UUID representations. //! //! ``` @@ -112,7 +112,7 @@ impl ShortGuid { /// Creates a [`ShortGuid`] using the supplied bytes. #[inline] pub fn from_slice>(bytes: B) -> Result { - 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)) } @@ -124,7 +124,7 @@ impl ShortGuid { /// instead. #[inline] pub fn from_bytes>(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. @@ -153,7 +153,7 @@ impl ShortGuid { /// ``` #[inline] pub fn from_bytes_le>(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. @@ -310,7 +310,7 @@ impl Debug for ShortGuid { write!( f, "{short} ({long})", - short = Self::encode(&self.0), + short = Self::encode(self.0), long = self.0 ) } @@ -318,7 +318,7 @@ impl Debug for ShortGuid { 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)) } }