Skip to content

Commit

Permalink
Resolve needless_borrowed_reference clippy lints
Browse files Browse the repository at this point in the history
    error: dereferencing a tuple pattern where every element takes a reference
       --> src/value/de.rs:997:18
        |
    997 |             Some(&Value::Array(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
        |
    997 -             Some(&Value::Array(ref v)) => {
    997 +             Some(Value::Array(v)) => {
        |

    error: dereferencing a tuple pattern where every element takes a reference
        --> src/value/de.rs:1024:18
         |
    1024 |             Some(&Value::Object(ref v)) => visit_object_ref(v, visitor),
         |                  ^^^^^^^^^^^^^^^^^^^^^
         |
         = 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
         |
    1024 -             Some(&Value::Object(ref v)) => visit_object_ref(v, visitor),
    1024 +             Some(Value::Object(v)) => visit_object_ref(v, visitor),
         |
  • Loading branch information
dtolnay committed Nov 23, 2022
1 parent d2f9368 commit 9295c96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/value/de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ impl<'de> VariantAccess<'de> for VariantRefDeserializer<'de> {
V: Visitor<'de>,
{
match self.value {
Some(&Value::Array(ref v)) => {
Some(Value::Array(v)) => {
if v.is_empty() {
visitor.visit_unit()
} else {
Expand All @@ -1021,7 +1021,7 @@ impl<'de> VariantAccess<'de> for VariantRefDeserializer<'de> {
V: Visitor<'de>,
{
match self.value {
Some(&Value::Object(ref v)) => visit_object_ref(v, visitor),
Some(Value::Object(v)) => visit_object_ref(v, visitor),
Some(other) => Err(serde::de::Error::invalid_type(
other.unexpected(),
&"struct variant",
Expand Down

0 comments on commit 9295c96

Please sign in to comment.