Skip to content

Commit

Permalink
Remove some fmt machinery by forwarding formatter directly to inner S…
Browse files Browse the repository at this point in the history
…lice
  • Loading branch information
lopopolo committed Apr 20, 2023
1 parent 8265509 commit 95c9acb
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,55 +81,35 @@ where

impl fmt::Debug for Interned<str> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.alternate() {
write!(f, "{:#?}", self.0)
} else {
write!(f, "{:?}", self.0)
}
self.0.fmt(f)
}
}

#[cfg(feature = "bytes")]
impl fmt::Debug for Interned<[u8]> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.alternate() {
write!(f, "{:#?}", self.0)
} else {
write!(f, "{:?}", self.0)
}
self.0.fmt(f)
}
}

#[cfg(feature = "cstr")]
impl fmt::Debug for Interned<CStr> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.alternate() {
write!(f, "{:#?}", self.0)
} else {
write!(f, "{:?}", self.0)
}
self.0.fmt(f)
}
}

#[cfg(feature = "osstr")]
impl fmt::Debug for Interned<OsStr> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.alternate() {
write!(f, "{:#?}", self.0)
} else {
write!(f, "{:?}", self.0)
}
self.0.fmt(f)
}
}

#[cfg(feature = "path")]
impl fmt::Debug for Interned<Path> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.alternate() {
write!(f, "{:#?}", self.0)
} else {
write!(f, "{:?}", self.0)
}
self.0.fmt(f)
}
}

Expand Down

0 comments on commit 95c9acb

Please sign in to comment.