Skip to content

Commit

Permalink
Refactoring fmt traits
Browse files Browse the repository at this point in the history
  • Loading branch information
DoumanAsh committed Nov 10, 2024
1 parent e5dfc04 commit 33ba0f1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,28 +473,28 @@ impl<const S: usize> AsRef<str> for StrBuf<S> {
}
}

impl<const S: usize> core::fmt::Write for StrBuf<S> {
impl<const S: usize> fmt::Write for StrBuf<S> {
#[inline(always)]
fn write_str(&mut self, s: &str) -> core::fmt::Result {
fn write_str(&mut self, s: &str) -> fmt::Result {
if self.push_str(s) == s.len() {
Ok(())
} else {
Err(core::fmt::Error)
Err(fmt::Error)
}
}
}

impl<const S: usize> core::fmt::Display for StrBuf<S> {
impl<const S: usize> fmt::Display for StrBuf<S> {
#[inline(always)]
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.write_str(self.as_str())
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(self.as_str(), fmt)
}
}

impl<const S: usize> core::fmt::Debug for StrBuf<S> {
impl<const S: usize> fmt::Debug for StrBuf<S> {
#[inline(always)]
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.write_str(self.as_str())
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt::Debug::fmt(self.as_str(), fmt)
}
}

Expand Down

0 comments on commit 33ba0f1

Please sign in to comment.