From 7238b12c8ece341cbd30ce3c1f0f16676204fa96 Mon Sep 17 00:00:00 2001 From: Pascal Seitz Date: Sat, 25 Jan 2025 11:39:26 +0100 Subject: [PATCH] fix compiler warnings --- src/cowstr.rs | 3 ++- src/index.rs | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cowstr.rs b/src/cowstr.rs index 0d2afae..0703883 100644 --- a/src/cowstr.rs +++ b/src/cowstr.rs @@ -1,4 +1,5 @@ -use std::{borrow::Cow, ops::Deref}; +use std::borrow::Cow; +use std::ops::Deref; use serde::Deserialize; diff --git a/src/index.rs b/src/index.rs index 03bb11d..7aace54 100644 --- a/src/index.rs +++ b/src/index.rs @@ -10,7 +10,6 @@ use super::Value; /// /// This trait is sealed and cannot be implemented for types outside of /// `serde_json_borrow`. - /// # Examples /// /// ``` @@ -36,12 +35,12 @@ use super::Value; pub trait Index<'v> { /// Return None if the key is not already in the array or object. #[doc(hidden)] - fn index_into(self, v: &'v Value<'v>) -> Option<&Value<'v>>; + fn index_into(self, v: &'v Value<'v>) -> Option<&'v Value<'v>>; } impl<'v> Index<'v> for usize { #[inline] - fn index_into(self, v: &'v Value<'v>) -> Option<&Value<'v>> { + fn index_into(self, v: &'v Value<'v>) -> Option<&'v Value<'v>> { match v { Value::Array(vec) => vec.get(self), _ => None, @@ -51,7 +50,7 @@ impl<'v> Index<'v> for usize { impl<'v, 'a: 'v> Index<'v> for &'a str { #[inline] - fn index_into(self, v: &'v Value<'v>) -> Option<&Value<'v>> { + fn index_into(self, v: &'v Value<'v>) -> Option<&'v Value<'v>> { match v { Value::Object(map) => map.iter().find(|(k, _v)| k == &self).map(|(_k, v)| v), _ => None,