fix: clippy errors (#3772)

* fix: use map instead of if else

* fix: needless lifetime
This commit is contained in:
Saber Haj Rabiee
2025-03-22 23:44:49 -07:00
committed by GitHub
parent a5d158765f
commit bc7c59d880
2 changed files with 8 additions and 13 deletions

View File

@@ -63,7 +63,7 @@ delegate_impl_len!(<T,> Vec<T>);
delegate_impl_len!(str);
delegate_impl_len!(String);
impl<'a> Len for Cow<'a, str> {
impl Len for Cow<'_, str> {
#[inline(always)]
fn len(&self) -> usize {
<str>::len(self)
@@ -75,7 +75,7 @@ impl<'a> Len for Cow<'a, str> {
}
}
impl<'a> Len for &Cow<'a, str> {
impl Len for &Cow<'_, str> {
#[inline(always)]
fn len(&self) -> usize {
Len::len(*self)
@@ -87,7 +87,7 @@ impl<'a> Len for &Cow<'a, str> {
}
}
impl<'a> Len for &mut Cow<'a, str> {
impl Len for &mut Cow<'_, str> {
#[inline(always)]
fn len(&self) -> usize {
Len::len(*self)
@@ -99,7 +99,7 @@ impl<'a> Len for &mut Cow<'a, str> {
}
}
impl<'a, T> Len for Cow<'a, [T]>
impl<T> Len for Cow<'_, [T]>
where
[T]: ToOwned,
{
@@ -114,7 +114,7 @@ where
}
}
impl<'a, T> Len for &Cow<'a, [T]>
impl<T> Len for &Cow<'_, [T]>
where
[T]: ToOwned,
{
@@ -129,7 +129,7 @@ where
}
}
impl<'a, T> Len for &mut Cow<'a, [T]>
impl<T> Len for &mut Cow<'_, [T]>
where
[T]: ToOwned,
{

View File

@@ -648,16 +648,11 @@ impl ServerFnCall {
/// Return the name and type of the first field if there is only one field.
fn single_field(&self) -> Option<(&Pat, &Type)> {
if let Some(field) = self
.body
self.body
.inputs
.first()
.filter(|_| self.body.inputs.len() == 1)
{
Some((&field.arg.pat, &field.arg.ty))
} else {
None
}
.map(|field| (&*field.arg.pat, &*field.arg.ty))
}
fn deref_impl(&self) -> TokenStream2 {