From 9295c96c8e2f3056beb23ba02a8d47f1704e5b02 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 22 Nov 2022 18:36:47 -0800 Subject: [PATCH] Resolve needless_borrowed_reference clippy lints 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), | --- src/value/de.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/value/de.rs b/src/value/de.rs index 09d69c980..9c266d08a 100644 --- a/src/value/de.rs +++ b/src/value/de.rs @@ -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 { @@ -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",