Skip to content

Commit

Permalink
Use #[inline] for FmtRef.
Browse files Browse the repository at this point in the history
  • Loading branch information
frozenlib committed May 30, 2024
1 parent 0e41049 commit 3f8e9f5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions parse-display/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,54 +25,63 @@ where
pub struct FmtRef<'a, T: ?Sized>(pub &'a T);

impl<'a, T: ?Sized + fmt::Display> fmt::Display for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(self.0, f)
}
}

impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.0, f)
}
}

impl<'a, T: ?Sized + fmt::Binary> fmt::Binary for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Binary::fmt(self.0, f)
}
}

impl<'a, T: ?Sized + fmt::Octal> fmt::Octal for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Octal::fmt(self.0, f)
}
}

impl<'a, T: ?Sized + fmt::LowerHex> fmt::LowerHex for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::LowerHex::fmt(self.0, f)
}
}

impl<'a, T: ?Sized + fmt::UpperHex> fmt::UpperHex for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::UpperHex::fmt(self.0, f)
}
}

impl<'a, T: ?Sized + fmt::Pointer> fmt::Pointer for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Pointer::fmt(self.0, f)
}
}

impl<'a, T: ?Sized + fmt::LowerExp> fmt::LowerExp for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::LowerExp::fmt(self.0, f)
}
}

impl<'a, T: ?Sized + fmt::UpperExp> fmt::UpperExp for FmtRef<'a, T> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::UpperExp::fmt(&self.0, f)
}
Expand Down

0 comments on commit 3f8e9f5

Please sign in to comment.