Skip to content

Commit

Permalink
impl: fix impl_partial_eq_cow to apply .as_bytes() and &** to t…
Browse files Browse the repository at this point in the history
…he correct arguments

`impl_partial_eq_cow`, in its second trail impl, had the arguments the
wrong way around, applying `&**` to the ByteStr argument and
`.as_bytes()` to the `Cow`.

Fix it to use the same structure as `impl_partial_eq`.

PR #203
  • Loading branch information
joshtriplett authored Jan 2, 2025
1 parent b669472 commit 1ade797
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ macro_rules! impl_partial_eq_cow {
impl<'a> PartialEq<$lhs> for $rhs {
#[inline]
fn eq(&self, other: &$lhs) -> bool {
let this: &[u8] = (&**other).as_ref();
PartialEq::eq(this, self.as_bytes())
let this: &[u8] = (&**self).as_ref();
PartialEq::eq(this, other.as_bytes())
}
}
};
Expand Down

0 comments on commit 1ade797

Please sign in to comment.