Skip to content

Commit

Permalink
fix "using .clone() on a double reference" warnings (#1700)
Browse files Browse the repository at this point in the history
Co-authored-by: rrupy <[email protected]>
  • Loading branch information
rrupy and thssuck authored Oct 21, 2023
1 parent 2857a9a commit 95d9926
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,15 +333,15 @@ 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 => {
if OM::Incomplete::is_streaming() {
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((
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 95d9926

Please sign in to comment.