From f288be96ece307026b8936531c0c60bd11d3a072 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Fri, 29 Nov 2024 10:25:08 -0600 Subject: [PATCH] style: Make clippy happy --- src/stack.rs | 4 ++-- src/string.rs | 2 +- src/string_cow.rs | 38 +++++++++++++++++++------------------- src/string_ref.rs | 32 ++++++++++++++++---------------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/stack.rs b/src/stack.rs index c6e8849..65f8892 100644 --- a/src/stack.rs +++ b/src/stack.rs @@ -278,7 +278,7 @@ impl PartialEq for StackString { } } -impl<'s, const CAPACITY: usize> PartialEq<&'s str> for StackString { +impl PartialEq<&str> for StackString { #[inline] fn eq(&self, other: &&str) -> bool { PartialEq::eq(self.as_str(), *other) @@ -313,7 +313,7 @@ impl PartialOrd for StackString { } } -impl<'s, const CAPACITY: usize> PartialOrd<&'s str> for StackString { +impl PartialOrd<&str> for StackString { #[inline] fn partial_cmp(&self, other: &&str) -> Option { self.as_str().partial_cmp(other) diff --git a/src/string.rs b/src/string.rs index 8635d10..3ebef4a 100644 --- a/src/string.rs +++ b/src/string.rs @@ -132,7 +132,7 @@ impl PartialEq for KStringBase { } } -impl<'s, B: crate::backend::HeapStr> PartialEq<&'s str> for KStringBase { +impl PartialEq<&str> for KStringBase { #[inline] fn eq(&self, other: &&str) -> bool { PartialEq::eq(self.as_str(), *other) diff --git a/src/string_cow.rs b/src/string_cow.rs index 627e5da..19c18de 100644 --- a/src/string_cow.rs +++ b/src/string_cow.rs @@ -23,7 +23,7 @@ pub(crate) enum KStringCowInner<'s, B> { Owned(KStringBase), } -impl<'s, B> KStringCowBase<'s, B> { +impl KStringCowBase<'_, B> { /// Create a new empty `KStringCowBase`. #[inline] #[must_use] @@ -155,7 +155,7 @@ impl<'s, B: crate::backend::HeapStr> KStringCowInner<'s, B> { } } -impl<'s, B: crate::backend::HeapStr> std::ops::Deref for KStringCowBase<'s, B> { +impl std::ops::Deref for KStringCowBase<'_, B> { type Target = str; #[inline] @@ -164,7 +164,7 @@ impl<'s, B: crate::backend::HeapStr> std::ops::Deref for KStringCowBase<'s, B> { } } -impl<'s, B: crate::backend::HeapStr> Eq for KStringCowBase<'s, B> {} +impl Eq for KStringCowBase<'_, B> {} impl<'s, B: crate::backend::HeapStr> PartialEq> for KStringCowBase<'s, B> { #[inline] @@ -173,7 +173,7 @@ impl<'s, B: crate::backend::HeapStr> PartialEq> for KStrin } } -impl<'s, B: crate::backend::HeapStr> PartialEq for KStringCowBase<'s, B> { +impl PartialEq for KStringCowBase<'_, B> { #[inline] fn eq(&self, other: &str) -> bool { PartialEq::eq(self.as_str(), other) @@ -187,91 +187,91 @@ impl<'s, B: crate::backend::HeapStr> PartialEq<&'s str> for KStringCowBase<'s, B } } -impl<'s, B: crate::backend::HeapStr> PartialEq for KStringCowBase<'s, B> { +impl PartialEq for KStringCowBase<'_, B> { #[inline] fn eq(&self, other: &StdString) -> bool { PartialEq::eq(self.as_str(), other.as_str()) } } -impl<'s, B: crate::backend::HeapStr> Ord for KStringCowBase<'s, B> { +impl Ord for KStringCowBase<'_, B> { #[inline] fn cmp(&self, other: &Self) -> std::cmp::Ordering { self.as_str().cmp(other.as_str()) } } -impl<'s, B: crate::backend::HeapStr> PartialOrd for KStringCowBase<'s, B> { +impl PartialOrd for KStringCowBase<'_, B> { #[inline] fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } -impl<'s, B: crate::backend::HeapStr> std::hash::Hash for KStringCowBase<'s, B> { +impl std::hash::Hash for KStringCowBase<'_, B> { #[inline] fn hash(&self, state: &mut H) { self.as_str().hash(state); } } -impl<'s, B: crate::backend::HeapStr> fmt::Debug for KStringCowBase<'s, B> { +impl fmt::Debug for KStringCowBase<'_, B> { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.as_str().fmt(f) } } -impl<'s, B: crate::backend::HeapStr> fmt::Display for KStringCowBase<'s, B> { +impl fmt::Display for KStringCowBase<'_, B> { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(self.as_str(), f) } } -impl<'s, B: crate::backend::HeapStr> AsRef for KStringCowBase<'s, B> { +impl AsRef for KStringCowBase<'_, B> { #[inline] fn as_ref(&self) -> &str { self.as_str() } } -impl<'s, B: crate::backend::HeapStr> AsRef<[u8]> for KStringCowBase<'s, B> { +impl AsRef<[u8]> for KStringCowBase<'_, B> { #[inline] fn as_ref(&self) -> &[u8] { self.as_bytes() } } -impl<'s, B: crate::backend::HeapStr> AsRef for KStringCowBase<'s, B> { +impl AsRef for KStringCowBase<'_, B> { #[inline] fn as_ref(&self) -> &std::ffi::OsStr { (**self).as_ref() } } -impl<'s, B: crate::backend::HeapStr> AsRef for KStringCowBase<'s, B> { +impl AsRef for KStringCowBase<'_, B> { #[inline] fn as_ref(&self) -> &std::path::Path { std::path::Path::new(self) } } -impl<'s, B: crate::backend::HeapStr> std::borrow::Borrow for KStringCowBase<'s, B> { +impl std::borrow::Borrow for KStringCowBase<'_, B> { #[inline] fn borrow(&self) -> &str { self.as_str() } } -impl<'s, B> Default for KStringCowBase<'s, B> { +impl Default for KStringCowBase<'_, B> { #[inline] fn default() -> Self { Self::new() } } -impl<'s, B: crate::backend::HeapStr> From> for KStringCowBase<'s, B> { +impl From> for KStringCowBase<'_, B> { #[inline] fn from(other: KStringBase) -> Self { let inner = KStringCowInner::Owned(other); @@ -307,7 +307,7 @@ impl<'s, B: crate::backend::HeapStr> From<&'s KStringRef<'s>> for KStringCowBase } } -impl<'s, B: crate::backend::HeapStr> From for KStringCowBase<'s, B> { +impl From for KStringCowBase<'_, B> { #[inline] fn from(other: StdString) -> Self { Self::from_string(other) @@ -321,7 +321,7 @@ impl<'s, B: crate::backend::HeapStr> From<&'s StdString> for KStringCowBase<'s, } } -impl<'s, B: crate::backend::HeapStr> From for KStringCowBase<'s, B> { +impl From for KStringCowBase<'_, B> { #[inline] fn from(other: BoxedStr) -> Self { // Since the memory is already allocated, don't bother moving it into a FixedString diff --git a/src/string_ref.rs b/src/string_ref.rs index 4e373f0..01771f9 100644 --- a/src/string_ref.rs +++ b/src/string_ref.rs @@ -68,7 +68,7 @@ impl<'s> KStringRef<'s> { } } -impl<'s> KStringRefInner<'s> { +impl KStringRefInner<'_> { #[inline] #[allow(clippy::wrong_self_convention)] fn to_owned(&self) -> KStringBase { @@ -92,7 +92,7 @@ impl<'s> KStringRefInner<'s> { } } -impl<'s> std::ops::Deref for KStringRef<'s> { +impl std::ops::Deref for KStringRef<'_> { type Target = str; #[inline] @@ -101,7 +101,7 @@ impl<'s> std::ops::Deref for KStringRef<'s> { } } -impl<'s> Eq for KStringRef<'s> {} +impl Eq for KStringRef<'_> {} impl<'s> PartialEq> for KStringRef<'s> { #[inline] @@ -110,7 +110,7 @@ impl<'s> PartialEq> for KStringRef<'s> { } } -impl<'s> PartialEq for KStringRef<'s> { +impl PartialEq for KStringRef<'_> { #[inline] fn eq(&self, other: &str) -> bool { PartialEq::eq(self.as_str(), other) @@ -124,84 +124,84 @@ impl<'s> PartialEq<&'s str> for KStringRef<'s> { } } -impl<'s> PartialEq for KStringRef<'s> { +impl PartialEq for KStringRef<'_> { #[inline] fn eq(&self, other: &StdString) -> bool { PartialEq::eq(self.as_str(), other.as_str()) } } -impl<'s> Ord for KStringRef<'s> { +impl Ord for KStringRef<'_> { #[inline] fn cmp(&self, other: &Self) -> std::cmp::Ordering { self.as_str().cmp(other.as_str()) } } -impl<'s> PartialOrd for KStringRef<'s> { +impl PartialOrd for KStringRef<'_> { #[inline] fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } } -impl<'s> std::hash::Hash for KStringRef<'s> { +impl std::hash::Hash for KStringRef<'_> { #[inline] fn hash(&self, state: &mut H) { self.as_str().hash(state); } } -impl<'s> fmt::Debug for KStringRef<'s> { +impl fmt::Debug for KStringRef<'_> { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Debug::fmt(&self.inner, f) } } -impl<'s> fmt::Display for KStringRef<'s> { +impl fmt::Display for KStringRef<'_> { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fmt::Display::fmt(self.as_str(), f) } } -impl<'s> AsRef for KStringRef<'s> { +impl AsRef for KStringRef<'_> { #[inline] fn as_ref(&self) -> &str { self.as_str() } } -impl<'s> AsRef<[u8]> for KStringRef<'s> { +impl AsRef<[u8]> for KStringRef<'_> { #[inline] fn as_ref(&self) -> &[u8] { self.as_bytes() } } -impl<'s> AsRef for KStringRef<'s> { +impl AsRef for KStringRef<'_> { #[inline] fn as_ref(&self) -> &std::ffi::OsStr { (**self).as_ref() } } -impl<'s> AsRef for KStringRef<'s> { +impl AsRef for KStringRef<'_> { #[inline] fn as_ref(&self) -> &std::path::Path { std::path::Path::new(self) } } -impl<'s> std::borrow::Borrow for KStringRef<'s> { +impl std::borrow::Borrow for KStringRef<'_> { #[inline] fn borrow(&self) -> &str { self.as_str() } } -impl<'s> Default for KStringRef<'s> { +impl Default for KStringRef<'_> { #[inline] fn default() -> Self { Self::new()