Skip to content

Commit

Permalink
Resolve some needless_lifetimes clippy lints
Browse files Browse the repository at this point in the history
    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<T: ?Sized + ToTokens> 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<T: ?Sized + ToTokens> 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 {
        |
  • Loading branch information
dtolnay committed Oct 7, 2024
1 parent 31d7a01 commit 87c247f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ 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) {
<T as RepAsIteratorExt>::quote_into_iter(*self)
}
}

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) {
Expand Down
4 changes: 2 additions & 2 deletions src/to_tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ pub trait ToTokens {
}
}

impl<'a, T: ?Sized + ToTokens> ToTokens for &'a T {
impl<T: ?Sized + ToTokens> 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<T: ?Sized + ToTokens> ToTokens for &mut T {
fn to_tokens(&self, tokens: &mut TokenStream) {
(**self).to_tokens(tokens);
}
Expand Down

0 comments on commit 87c247f

Please sign in to comment.