Skip to content

Commit

Permalink
impl: remove unused 'b lifetime from trait implementation macros
Browse files Browse the repository at this point in the history
The macros implementing PartialEq and PartialOrd all provide lifetimes
'a and 'b to the types they receive, but none of the invocations of
these macros ever use 'b.

This was maybe a copy-and-paste gaffe?

PR #202
  • Loading branch information
joshtriplett authored Jan 2, 2025
1 parent de55623 commit 7cd4694
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/impls.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
macro_rules! impl_partial_eq {
($lhs:ty, $rhs:ty) => {
impl<'a, 'b> PartialEq<$rhs> for $lhs {
impl<'a> PartialEq<$rhs> for $lhs {
#[inline]
fn eq(&self, other: &$rhs) -> bool {
let other: &[u8] = other.as_ref();
PartialEq::eq(self.as_bytes(), other)
}
}

impl<'a, 'b> PartialEq<$lhs> for $rhs {
impl<'a> PartialEq<$lhs> for $rhs {
#[inline]
fn eq(&self, other: &$lhs) -> bool {
let this: &[u8] = self.as_ref();
Expand All @@ -20,15 +20,15 @@ macro_rules! impl_partial_eq {

macro_rules! impl_partial_eq_n {
($lhs:ty, $rhs:ty) => {
impl<'a, 'b, const N: usize> PartialEq<$rhs> for $lhs {
impl<'a, const N: usize> PartialEq<$rhs> for $lhs {
#[inline]
fn eq(&self, other: &$rhs) -> bool {
let other: &[u8] = other.as_ref();
PartialEq::eq(self.as_bytes(), other)
}
}

impl<'a, 'b, const N: usize> PartialEq<$lhs> for $rhs {
impl<'a, const N: usize> PartialEq<$lhs> for $rhs {
#[inline]
fn eq(&self, other: &$lhs) -> bool {
let this: &[u8] = self.as_ref();
Expand All @@ -41,15 +41,15 @@ macro_rules! impl_partial_eq_n {
#[cfg(feature = "alloc")]
macro_rules! impl_partial_eq_cow {
($lhs:ty, $rhs:ty) => {
impl<'a, 'b> PartialEq<$rhs> for $lhs {
impl<'a> PartialEq<$rhs> for $lhs {
#[inline]
fn eq(&self, other: &$rhs) -> bool {
let other: &[u8] = (&**other).as_ref();
PartialEq::eq(self.as_bytes(), other)
}
}

impl<'a, 'b> PartialEq<$lhs> for $rhs {
impl<'a> PartialEq<$lhs> for $rhs {
#[inline]
fn eq(&self, other: &$lhs) -> bool {
let this: &[u8] = (&**other).as_ref();
Expand All @@ -61,15 +61,15 @@ macro_rules! impl_partial_eq_cow {

macro_rules! impl_partial_ord {
($lhs:ty, $rhs:ty) => {
impl<'a, 'b> PartialOrd<$rhs> for $lhs {
impl<'a> PartialOrd<$rhs> for $lhs {
#[inline]
fn partial_cmp(&self, other: &$rhs) -> Option<Ordering> {
let other: &[u8] = other.as_ref();
PartialOrd::partial_cmp(self.as_bytes(), other)
}
}

impl<'a, 'b> PartialOrd<$lhs> for $rhs {
impl<'a> PartialOrd<$lhs> for $rhs {
#[inline]
fn partial_cmp(&self, other: &$lhs) -> Option<Ordering> {
let this: &[u8] = self.as_ref();
Expand All @@ -81,15 +81,15 @@ macro_rules! impl_partial_ord {

macro_rules! impl_partial_ord_n {
($lhs:ty, $rhs:ty) => {
impl<'a, 'b, const N: usize> PartialOrd<$rhs> for $lhs {
impl<'a, const N: usize> PartialOrd<$rhs> for $lhs {
#[inline]
fn partial_cmp(&self, other: &$rhs) -> Option<Ordering> {
let other: &[u8] = other.as_ref();
PartialOrd::partial_cmp(self.as_bytes(), other)
}
}

impl<'a, 'b, const N: usize> PartialOrd<$lhs> for $rhs {
impl<'a, const N: usize> PartialOrd<$lhs> for $rhs {
#[inline]
fn partial_cmp(&self, other: &$lhs) -> Option<Ordering> {
let this: &[u8] = self.as_ref();
Expand Down

0 comments on commit 7cd4694

Please sign in to comment.