From 87c247ff2c46a66218df61dde33fd2406293ea86 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Mon, 7 Oct 2024 21:29:43 +0200 Subject: [PATCH] Resolve some needless_lifetimes clippy lints warning: the following explicit lifetimes could be elided: 'a --> src/to_tokens.rs:78:6 | 78 | impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `-W clippy::needless-lifetimes` implied by `-W clippy::all` = help: to override `-W clippy::all` add `#[allow(clippy::needless_lifetimes)]` help: elide the lifetimes | 78 - impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T { 78 + impl ToTokens for &T { | warning: the following explicit lifetimes could be elided: 'a --> src/to_tokens.rs:84:6 | 84 | impl<'a, T: ?Sized + ToTokens> ToTokens for &'a mut T { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 84 - impl<'a, T: ?Sized + ToTokens> ToTokens for &'a mut T { 84 + impl ToTokens for &mut T { | warning: the following explicit lifetimes could be elided: 'a --> src/runtime.rs:105:14 | 105 | impl<'q, 'a, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &'a T { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 105 - impl<'q, 'a, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &'a T { 105 + impl<'q, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &T { | warning: the following explicit lifetimes could be elided: 'a --> src/runtime.rs:113:14 | 113 | impl<'q, 'a, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &'a mut T { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 113 - impl<'q, 'a, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &'a mut T { 113 + impl<'q, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &mut T { | --- src/runtime.rs | 4 ++-- src/to_tokens.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/runtime.rs b/src/runtime.rs index eff044a..dc29665 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -102,7 +102,7 @@ pub mod ext { fn quote_into_iter(&'q self) -> (Self::Iter, HasIter); } - impl<'q, 'a, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &'a T { + impl<'q, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &T { type Iter = T::Iter; fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { @@ -110,7 +110,7 @@ pub mod ext { } } - impl<'q, 'a, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &'a mut T { + impl<'q, T: RepAsIteratorExt<'q> + ?Sized> RepAsIteratorExt<'q> for &mut T { type Iter = T::Iter; fn quote_into_iter(&'q self) -> (Self::Iter, HasIter) { diff --git a/src/to_tokens.rs b/src/to_tokens.rs index 2bcb961..0fbbe22 100644 --- a/src/to_tokens.rs +++ b/src/to_tokens.rs @@ -75,13 +75,13 @@ pub trait ToTokens { } } -impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T { +impl ToTokens for &T { fn to_tokens(&self, tokens: &mut TokenStream) { (**self).to_tokens(tokens); } } -impl<'a, T: ?Sized + ToTokens> ToTokens for &'a mut T { +impl ToTokens for &mut T { fn to_tokens(&self, tokens: &mut TokenStream) { (**self).to_tokens(tokens); }