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/de.rs:1381:11
         |
    1381 | impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer<R> {
         |           ^^                                           ^^
         |
         = 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
         |
    1381 - impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer<R> {
    1381 + impl<'de, R: Read<'de>> de::Deserializer<'de> for &mut Deserializer<R> {
         |

    warning: the following explicit lifetimes could be elided: 'a
       --> src/map.rs:418:6
        |
    418 | impl<'a, Q> ops::Index<&'a Q> for Map<String, Value>
        |      ^^                 ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    418 - impl<'a, Q> ops::Index<&'a Q> for Map<String, Value>
    418 + impl<Q> ops::Index<&Q> for Map<String, Value>
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> src/map.rs:441:6
        |
    441 | impl<'a, Q> ops::IndexMut<&'a Q> for Map<String, Value>
        |      ^^                    ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    441 - impl<'a, Q> ops::IndexMut<&'a Q> for Map<String, Value>
    441 + impl<Q> ops::IndexMut<&Q> for Map<String, Value>
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> src/value/index.rs:140:10
        |
    140 |     impl<'a, T> Sealed for &'a T where T: ?Sized + Sealed {}
        |          ^^                 ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    140 -     impl<'a, T> Sealed for &'a T where T: ?Sized + Sealed {}
    140 +     impl<T> Sealed for &T where T: ?Sized + Sealed {}
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> src/number.rs:612:11
        |
    612 | impl<'de, 'a> Deserializer<'de> for &'a Number {
        |           ^^                         ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    612 - impl<'de, 'a> Deserializer<'de> for &'a Number {
    612 + impl<'de> Deserializer<'de> for &Number {
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> src/read.rs:754:6
        |
    754 | impl<'a, 'de, R> private::Sealed for &'a mut R where R: Read<'de> {}
        |      ^^                               ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    754 - impl<'a, 'de, R> private::Sealed for &'a mut R where R: Read<'de> {}
    754 + impl<'de, R> private::Sealed for &mut R where R: Read<'de> {}
        |

    warning: the following explicit lifetimes could be elided: 'a
       --> src/read.rs:756:6
        |
    756 | impl<'a, 'de, R> Read<'de> for &'a mut R
        |      ^^                         ^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
    help: elide the lifetimes
        |
    756 - impl<'a, 'de, R> Read<'de> for &'a mut R
    756 + impl<'de, R> Read<'de> for &mut R
        |
  • Loading branch information
dtolnay committed Oct 7, 2024
1 parent 309cfc9 commit ef9ca27
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ macro_rules! check_recursion {
};
}

impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer<R> {
impl<'de, R: Read<'de>> de::Deserializer<'de> for &mut Deserializer<R> {
type Error = Error;

#[inline]
Expand Down
4 changes: 2 additions & 2 deletions src/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ impl Hash for Map<String, Value> {
/// }
/// # ;
/// ```
impl<'a, Q> ops::Index<&'a Q> for Map<String, Value>
impl<Q> ops::Index<&Q> for Map<String, Value>
where
String: Borrow<Q>,
Q: ?Sized + Ord + Eq + Hash,
Expand All @@ -438,7 +438,7 @@ where
/// #
/// map["key"] = json!("value");
/// ```
impl<'a, Q> ops::IndexMut<&'a Q> for Map<String, Value>
impl<Q> ops::IndexMut<&Q> for Map<String, Value>
where
String: Borrow<Q>,
Q: ?Sized + Ord + Eq + Hash,
Expand Down
2 changes: 1 addition & 1 deletion src/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ impl<'de> Deserializer<'de> for Number {
}
}

impl<'de, 'a> Deserializer<'de> for &'a Number {
impl<'de> Deserializer<'de> for &Number {
type Error = Error;

deserialize_any!(ref);
Expand Down
4 changes: 2 additions & 2 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,9 +751,9 @@ impl<'a> Read<'a> for StrRead<'a> {

//////////////////////////////////////////////////////////////////////////////

impl<'a, 'de, R> private::Sealed for &'a mut R where R: Read<'de> {}
impl<'de, R> private::Sealed for &mut R where R: Read<'de> {}

impl<'a, 'de, R> Read<'de> for &'a mut R
impl<'de, R> Read<'de> for &mut R
where
R: Read<'de>,
{
Expand Down
2 changes: 1 addition & 1 deletion src/value/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ mod private {
impl Sealed for usize {}
impl Sealed for str {}
impl Sealed for alloc::string::String {}
impl<'a, T> Sealed for &'a T where T: ?Sized + Sealed {}
impl<T> Sealed for &T where T: ?Sized + Sealed {}
}

/// Used in panic messages.
Expand Down

0 comments on commit ef9ca27

Please sign in to comment.