Skip to content

Commit

Permalink
Remove formatting impls for Alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
clarfonthey committed Oct 13, 2023
1 parent 5c7f096 commit 644e025
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions library/core/src/ptr/alignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,41 +163,6 @@ impl fmt::Debug for Alignment {
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl fmt::Display for Alignment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.as_nonzero(), f)
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl fmt::Binary for Alignment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Binary::fmt(&self.as_nonzero(), f)
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl fmt::Octal for Alignment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Octal::fmt(&self.as_nonzero(), f)
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl fmt::LowerHex for Alignment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::LowerHex::fmt(&self.as_nonzero(), f)
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl fmt::UpperHex for Alignment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::UpperHex::fmt(&self.as_nonzero(), f)
}
}

impl Alignment {
// longest string: 1p-128
fn fmt_exp(self, buf: &mut [u8; 6], p: u8) -> &[u8] {
Expand Down Expand Up @@ -230,25 +195,6 @@ impl Alignment {
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl fmt::LowerExp for Alignment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut buf = [0; 6];

// SAFETY: We generate an ASCII string, which is valid UTF-8.
f.pad(unsafe { str::from_utf8_unchecked(self.fmt_exp(&mut buf, b'p')) })
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl fmt::UpperExp for Alignment {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let mut buf = [0; 6];
// SAFETY: We generate an ASCII string, which is valid UTF-8.
f.pad(unsafe { str::from_utf8_unchecked(self.fmt_exp(&mut buf, b'P')) })
}
}

#[unstable(feature = "ptr_alignment_type", issue = "102070")]
impl TryFrom<NonZeroUsize> for Alignment {
type Error = num::TryFromIntError;
Expand Down

0 comments on commit 644e025

Please sign in to comment.