Skip to content

Commit

Permalink
style: Make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 29, 2024
1 parent e55ae35 commit f288be9
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl<const CAPACITY: usize> PartialEq<str> for StackString<CAPACITY> {
}
}

impl<'s, const CAPACITY: usize> PartialEq<&'s str> for StackString<CAPACITY> {
impl<const CAPACITY: usize> PartialEq<&str> for StackString<CAPACITY> {
#[inline]
fn eq(&self, other: &&str) -> bool {
PartialEq::eq(self.as_str(), *other)
Expand Down Expand Up @@ -313,7 +313,7 @@ impl<const CAPACITY: usize> PartialOrd<str> for StackString<CAPACITY> {
}
}

impl<'s, const CAPACITY: usize> PartialOrd<&'s str> for StackString<CAPACITY> {
impl<const CAPACITY: usize> PartialOrd<&str> for StackString<CAPACITY> {
#[inline]
fn partial_cmp(&self, other: &&str) -> Option<std::cmp::Ordering> {
self.as_str().partial_cmp(other)
Expand Down
2 changes: 1 addition & 1 deletion src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl<B: crate::backend::HeapStr> PartialEq<str> for KStringBase<B> {
}
}

impl<'s, B: crate::backend::HeapStr> PartialEq<&'s str> for KStringBase<B> {
impl<B: crate::backend::HeapStr> PartialEq<&str> for KStringBase<B> {
#[inline]
fn eq(&self, other: &&str) -> bool {
PartialEq::eq(self.as_str(), *other)
Expand Down
38 changes: 19 additions & 19 deletions src/string_cow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub(crate) enum KStringCowInner<'s, B> {
Owned(KStringBase<B>),
}

impl<'s, B> KStringCowBase<'s, B> {
impl<B> KStringCowBase<'_, B> {
/// Create a new empty `KStringCowBase`.
#[inline]
#[must_use]
Expand Down Expand Up @@ -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<B: crate::backend::HeapStr> std::ops::Deref for KStringCowBase<'_, B> {
type Target = str;

#[inline]
Expand All @@ -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<B: crate::backend::HeapStr> Eq for KStringCowBase<'_, B> {}

impl<'s, B: crate::backend::HeapStr> PartialEq<KStringCowBase<'s, B>> for KStringCowBase<'s, B> {
#[inline]
Expand All @@ -173,7 +173,7 @@ impl<'s, B: crate::backend::HeapStr> PartialEq<KStringCowBase<'s, B>> for KStrin
}
}

impl<'s, B: crate::backend::HeapStr> PartialEq<str> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> PartialEq<str> for KStringCowBase<'_, B> {
#[inline]
fn eq(&self, other: &str) -> bool {
PartialEq::eq(self.as_str(), other)
Expand All @@ -187,91 +187,91 @@ impl<'s, B: crate::backend::HeapStr> PartialEq<&'s str> for KStringCowBase<'s, B
}
}

impl<'s, B: crate::backend::HeapStr> PartialEq<String> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> PartialEq<String> 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<B: crate::backend::HeapStr> 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<B: crate::backend::HeapStr> PartialOrd for KStringCowBase<'_, B> {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl<'s, B: crate::backend::HeapStr> std::hash::Hash for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> std::hash::Hash for KStringCowBase<'_, B> {
#[inline]
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
self.as_str().hash(state);
}
}

impl<'s, B: crate::backend::HeapStr> fmt::Debug for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> 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<B: crate::backend::HeapStr> 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<str> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> AsRef<str> 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<B: crate::backend::HeapStr> AsRef<[u8]> for KStringCowBase<'_, B> {
#[inline]
fn as_ref(&self) -> &[u8] {
self.as_bytes()
}
}

impl<'s, B: crate::backend::HeapStr> AsRef<std::ffi::OsStr> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> AsRef<std::ffi::OsStr> for KStringCowBase<'_, B> {
#[inline]
fn as_ref(&self) -> &std::ffi::OsStr {
(**self).as_ref()
}
}

impl<'s, B: crate::backend::HeapStr> AsRef<std::path::Path> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> AsRef<std::path::Path> 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<str> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> std::borrow::Borrow<str> for KStringCowBase<'_, B> {
#[inline]
fn borrow(&self) -> &str {
self.as_str()
}
}

impl<'s, B> Default for KStringCowBase<'s, B> {
impl<B> Default for KStringCowBase<'_, B> {
#[inline]
fn default() -> Self {
Self::new()
}
}

impl<'s, B: crate::backend::HeapStr> From<KStringBase<B>> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> From<KStringBase<B>> for KStringCowBase<'_, B> {
#[inline]
fn from(other: KStringBase<B>) -> Self {
let inner = KStringCowInner::Owned(other);
Expand Down Expand Up @@ -307,7 +307,7 @@ impl<'s, B: crate::backend::HeapStr> From<&'s KStringRef<'s>> for KStringCowBase
}
}

impl<'s, B: crate::backend::HeapStr> From<StdString> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> From<StdString> for KStringCowBase<'_, B> {
#[inline]
fn from(other: StdString) -> Self {
Self::from_string(other)
Expand All @@ -321,7 +321,7 @@ impl<'s, B: crate::backend::HeapStr> From<&'s StdString> for KStringCowBase<'s,
}
}

impl<'s, B: crate::backend::HeapStr> From<BoxedStr> for KStringCowBase<'s, B> {
impl<B: crate::backend::HeapStr> From<BoxedStr> for KStringCowBase<'_, B> {
#[inline]
fn from(other: BoxedStr) -> Self {
// Since the memory is already allocated, don't bother moving it into a FixedString
Expand Down
32 changes: 16 additions & 16 deletions src/string_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ impl<'s> KStringRef<'s> {
}
}

impl<'s> KStringRefInner<'s> {
impl KStringRefInner<'_> {
#[inline]
#[allow(clippy::wrong_self_convention)]
fn to_owned<B: crate::backend::HeapStr>(&self) -> KStringBase<B> {
Expand All @@ -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]
Expand All @@ -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<KStringRef<'s>> for KStringRef<'s> {
#[inline]
Expand All @@ -110,7 +110,7 @@ impl<'s> PartialEq<KStringRef<'s>> for KStringRef<'s> {
}
}

impl<'s> PartialEq<str> for KStringRef<'s> {
impl PartialEq<str> for KStringRef<'_> {
#[inline]
fn eq(&self, other: &str) -> bool {
PartialEq::eq(self.as_str(), other)
Expand All @@ -124,84 +124,84 @@ impl<'s> PartialEq<&'s str> for KStringRef<'s> {
}
}

impl<'s> PartialEq<String> for KStringRef<'s> {
impl PartialEq<String> 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<std::cmp::Ordering> {
Some(self.cmp(other))
}
}

impl<'s> std::hash::Hash for KStringRef<'s> {
impl std::hash::Hash for KStringRef<'_> {
#[inline]
fn hash<H: std::hash::Hasher>(&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<str> for KStringRef<'s> {
impl AsRef<str> 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<std::ffi::OsStr> for KStringRef<'s> {
impl AsRef<std::ffi::OsStr> for KStringRef<'_> {
#[inline]
fn as_ref(&self) -> &std::ffi::OsStr {
(**self).as_ref()
}
}

impl<'s> AsRef<std::path::Path> for KStringRef<'s> {
impl AsRef<std::path::Path> for KStringRef<'_> {
#[inline]
fn as_ref(&self) -> &std::path::Path {
std::path::Path::new(self)
}
}

impl<'s> std::borrow::Borrow<str> for KStringRef<'s> {
impl std::borrow::Borrow<str> 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()
Expand Down

0 comments on commit f288be9

Please sign in to comment.