Resolve needless_borrowed_reference clippy lints

error: dereferencing a tuple pattern where every element takes a reference
        --> serde/src/private/de.rs:1813:39
         |
    1813 |         let map = content.iter().map(|&(ref k, ref v)| {
         |                                       ^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
         = note: `-D clippy::needless-borrowed-reference` implied by `-D clippy::all`
    help: try removing the `&` and `ref` parts
         |
    1813 -         let map = content.iter().map(|&(ref k, ref v)| {
    1813 +         let map = content.iter().map(|(k, v)| {
         |

    error: dereferencing a tuple pattern where every element takes a reference
        --> serde/src/private/de.rs:2110:25
         |
    2110 |                     let &(ref variant, ref value) = match iter.next() {
         |                         ^^^^^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
    help: try removing the `&` and `ref` parts
         |
    2110 -                     let &(ref variant, ref value) = match iter.next() {
    2110 +                     let (variant, value) = match iter.next() {
         |

    error: dereferencing a tuple pattern where every element takes a reference
        --> serde/src/private/de.rs:2257:22
         |
    2257 |                 Some(&Content::Seq(ref v)) => {
         |                      ^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
    help: try removing the `&` and `ref` parts
         |
    2257 -                 Some(&Content::Seq(ref v)) => {
    2257 +                 Some(Content::Seq(v)) => {
         |

    error: dereferencing a tuple pattern where every element takes a reference
        --> serde/src/private/de.rs:2280:22
         |
    2280 |                 Some(&Content::Map(ref v)) => {
         |                      ^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
    help: try removing the `&` and `ref` parts
         |
    2280 -                 Some(&Content::Map(ref v)) => {
    2280 +                 Some(Content::Map(v)) => {
         |

    error: dereferencing a tuple pattern where every element takes a reference
        --> serde/src/private/de.rs:2283:22
         |
    2283 |                 Some(&Content::Seq(ref v)) => {
         |                      ^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
    help: try removing the `&` and `ref` parts
         |
    2283 -                 Some(&Content::Seq(ref v)) => {
    2283 +                 Some(Content::Seq(v)) => {
         |

    error: dereferencing a tuple pattern where every element takes a reference
        --> serde/src/private/de.rs:2406:22
         |
    2406 |                 Some(&(ref key, ref value)) => {
         |                      ^^^^^^^^^^^^^^^^^^^^^
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
    help: try removing the `&` and `ref` parts
         |
    2406 -                 Some(&(ref key, ref value)) => {
    2406 +                 Some((key, value)) => {
         |

    error: dereferencing a tuple pattern where every element takes a reference
       --> serde/src/private/ser.rs:528:25
        |
    528 |                     for &(ref k, ref v) in entries {
        |                         ^^^^^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference
    help: try removing the `&` and `ref` parts
        |
    528 -                     for &(ref k, ref v) in entries {
    528 +                     for (k, v) in entries {
        |
This commit is contained in:
David Tolnay 2022-11-22 18:40:27 -08:00
parent 072145e0e9
commit 51ea34b217
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 7 additions and 7 deletions

View File

@ -1810,7 +1810,7 @@ mod content {
V: Visitor<'de>,
E: de::Error,
{
let map = content.iter().map(|&(ref k, ref v)| {
let map = content.iter().map(|(k, v)| {
(
ContentRefDeserializer::new(k),
ContentRefDeserializer::new(v),
@ -2107,7 +2107,7 @@ mod content {
let (variant, value) = match *self.content {
Content::Map(ref value) => {
let mut iter = value.iter();
let &(ref variant, ref value) = match iter.next() {
let (variant, value) = match iter.next() {
Some(v) => v,
None => {
return Err(de::Error::invalid_value(
@ -2254,7 +2254,7 @@ mod content {
V: de::Visitor<'de>,
{
match self.value {
Some(&Content::Seq(ref v)) => {
Some(Content::Seq(v)) => {
de::Deserializer::deserialize_any(SeqRefDeserializer::new(v), visitor)
}
Some(other) => Err(de::Error::invalid_type(
@ -2277,10 +2277,10 @@ mod content {
V: de::Visitor<'de>,
{
match self.value {
Some(&Content::Map(ref v)) => {
Some(Content::Map(v)) => {
de::Deserializer::deserialize_any(MapRefDeserializer::new(v), visitor)
}
Some(&Content::Seq(ref v)) => {
Some(Content::Seq(v)) => {
de::Deserializer::deserialize_any(SeqRefDeserializer::new(v), visitor)
}
Some(other) => Err(de::Error::invalid_type(
@ -2403,7 +2403,7 @@ mod content {
T: de::DeserializeSeed<'de>,
{
match self.iter.next() {
Some(&(ref key, ref value)) => {
Some((key, value)) => {
self.value = Some(value);
seed.deserialize(ContentRefDeserializer::new(key)).map(Some)
}

View File

@ -525,7 +525,7 @@ mod content {
Content::Map(ref entries) => {
use ser::SerializeMap;
let mut map = try!(serializer.serialize_map(Some(entries.len())));
for &(ref k, ref v) in entries {
for (k, v) in entries {
try!(map.serialize_entry(k, v));
}
map.end()