From 9d86391170006bcbc98442b5e40fddbd57af3458 Mon Sep 17 00:00:00 2001 From: Michael Diamond Date: Fri, 6 Oct 2023 00:50:19 -0700 Subject: [PATCH] Remove a few unnecessary lifetimes --- src/value/from.rs | 6 +++--- src/value/index.rs | 2 +- src/value/partial_eq.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/value/from.rs b/src/value/from.rs index 159592ba8..9f996e0c4 100644 --- a/src/value/from.rs +++ b/src/value/from.rs @@ -91,7 +91,7 @@ impl From for Value { } } -impl<'a> From<&'a str> for Value { +impl From<&str> for Value { /// Convert string slice to `Value` /// /// # Examples @@ -181,7 +181,7 @@ impl> From> for Value { } } -impl<'a, T: Clone + Into> From<&'a [T]> for Value { +impl> From<&[T]> for Value { /// Convert a slice to `Value` /// /// # Examples @@ -192,7 +192,7 @@ impl<'a, T: Clone + Into> From<&'a [T]> for Value { /// let v: &[&str] = &["lorem", "ipsum", "dolor"]; /// let x: Value = v.into(); /// ``` - fn from(f: &'a [T]) -> Self { + fn from(f: &[T]) -> Self { Value::Array(f.iter().cloned().map(Into::into).collect()) } } diff --git a/src/value/index.rs b/src/value/index.rs index c74042b75..891ca8ef7 100644 --- a/src/value/index.rs +++ b/src/value/index.rs @@ -116,7 +116,7 @@ impl Index for String { } } -impl<'a, T> Index for &'a T +impl Index for &T where T: ?Sized + Index, { diff --git a/src/value/partial_eq.rs b/src/value/partial_eq.rs index 6b2e350b6..46c1dbc33 100644 --- a/src/value/partial_eq.rs +++ b/src/value/partial_eq.rs @@ -34,7 +34,7 @@ impl PartialEq for Value { } } -impl<'a> PartialEq<&'a str> for Value { +impl PartialEq<&str> for Value { fn eq(&self, other: &&str) -> bool { eq_str(self, *other) } @@ -46,7 +46,7 @@ impl PartialEq for str { } } -impl<'a> PartialEq for &'a str { +impl PartialEq for &str { fn eq(&self, other: &Value) -> bool { eq_str(other, *self) }