From 95d992633620e2db1000481e8fb224d3d5c813b7 Mon Sep 17 00:00:00 2001 From: rrupy <147432801+rrupy@users.noreply.github.com> Date: Sat, 21 Oct 2023 12:04:21 +0000 Subject: [PATCH] fix "using `.clone()` on a double reference" warnings (#1700) Co-authored-by: rrupy --- src/traits.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/traits.rs b/src/traits.rs index 9f74f8c73..30ac9eb75 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -333,7 +333,7 @@ impl<'a> Input for &'a [u8] { { match self.iter().position(|c| predicate(*c)) { Some(0) => Err(Err::Error(OM::Error::bind(|| { - E::from_error_kind(self.clone(), e) + E::from_error_kind(self, e) }))), Some(n) => Ok((self.take_from(n), OM::Output::bind(|| self.take(n)))), None => { @@ -341,7 +341,7 @@ impl<'a> Input for &'a [u8] { Err(Err::Incomplete(Needed::new(1))) } else if self.is_empty() { Err(Err::Error(OM::Error::bind(|| { - E::from_error_kind(self.clone(), e) + E::from_error_kind(self, e) }))) } else { Ok(( @@ -530,7 +530,7 @@ impl<'a> Input for &'a str { { match self.find(predicate) { Some(0) => Err(Err::Error(OM::Error::bind(|| { - E::from_error_kind(self.clone(), e) + E::from_error_kind(self, e) }))), Some(n) => unsafe { // find() returns a byte index that is already in the slice at a char boundary @@ -544,7 +544,7 @@ impl<'a> Input for &'a str { Err(Err::Incomplete(Needed::new(1))) } else if self.len() == 0 { Err(Err::Error(OM::Error::bind(|| { - E::from_error_kind(self.clone(), e) + E::from_error_kind(self, e) }))) } else { // the end of slice is a char boundary