Skip to content

Commit

Permalink
Fix indenting and brakets
Browse files Browse the repository at this point in the history
  • Loading branch information
zlfn committed Oct 15, 2024
1 parent 84ec14a commit 42c61e2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
4 changes: 2 additions & 2 deletions library/core/src/fmt/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ where
}

macro_rules! floating {
($($ty:ident)*) => (
($($ty:ident)*) => {
$(
#[stable(feature = "rust1", since = "1.0.0")]
impl Debug for $ty {
Expand Down Expand Up @@ -226,7 +226,7 @@ macro_rules! floating {
}
}
)*
)
};
}

floating! { f32 f64 }
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/fmt/nofloat.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::fmt::{Debug, Formatter, Result};

macro_rules! floating {
($($ty:ident)*) => (
($($ty:ident)*) => {
$(
#[stable(feature = "rust1", since = "1.0.0")]
impl Debug for $ty {
Expand All @@ -11,7 +11,7 @@ macro_rules! floating {
}
}
)*
)
};
}

floating! { f16 f32 f64 f128 }
49 changes: 25 additions & 24 deletions library/core/src/fmt/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ trait DisplayInt:

macro_rules! impl_int {
($($t:ident)*) => (
$(impl DisplayInt for $t {
fn zero() -> Self { 0 }
fn from_u8(u: u8) -> Self { u as Self }
fn to_u8(&self) -> u8 { *self as u8 }
#[cfg(not(any(target_pointer_width = "64", target_arch = "wasm32")))]
fn to_u32(&self) -> u32 { *self as u32 }
fn to_u64(&self) -> u64 { *self as u64 }
fn to_u128(&self) -> u128 { *self as u128 }
})*
$(impl DisplayInt for $t {
fn zero() -> Self { 0 }
fn from_u8(u: u8) -> Self { u as Self }
fn to_u8(&self) -> u8 { *self as u8 }
#[cfg(not(any(target_pointer_width = "64", target_arch = "wasm32")))]
fn to_u32(&self) -> u32 { *self as u32 }
fn to_u64(&self) -> u64 { *self as u64 }
fn to_u128(&self) -> u128 { *self as u128 }
})*
)
}

Expand Down Expand Up @@ -169,22 +169,23 @@ integer! { i64, u64 }
integer! { i128, u128 }

macro_rules! impl_Debug {
($($T:ident)*) => (
($($T:ident)*) => {
$(
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for $T {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.debug_lower_hex() {
fmt::LowerHex::fmt(self, f)
} else if f.debug_upper_hex() {
fmt::UpperHex::fmt(self, f)
} else {
fmt::Display::fmt(self, f)
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Debug for $T {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
if f.debug_lower_hex() {
fmt::LowerHex::fmt(self, f)
} else if f.debug_upper_hex() {
fmt::UpperHex::fmt(self, f)
} else {
fmt::Display::fmt(self, f)
}
}
}
})*
)
)*
};
}

// 2 digit decimal look up table
Expand Down Expand Up @@ -509,8 +510,8 @@ macro_rules! impl_Exp {
}

impl_Debug! {
i8 i16 i32 i64 i128 isize
u8 u16 u32 u64 u128 usize
i8 i16 i32 i64 i128 isize
u8 u16 u32 u64 u128 usize
}

// Include wasm32 in here since it doesn't reflect the native pointer size, and
Expand Down

0 comments on commit 42c61e2

Please sign in to comment.