Refactor floating
macro and nofloat panic message
This commit is contained in:
parent
0637517da6
commit
99af761632
@ -196,7 +196,8 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! floating {
|
macro_rules! floating {
|
||||||
($ty:ident) => {
|
($($ty:ident)*) => {
|
||||||
|
$(
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl Debug for $ty {
|
impl Debug for $ty {
|
||||||
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
|
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
|
||||||
@ -224,11 +225,11 @@ macro_rules! floating {
|
|||||||
float_to_exponential_common(fmt, self, true)
|
float_to_exponential_common(fmt, self, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
)*
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
floating! { f32 }
|
floating! { f32 f64 }
|
||||||
floating! { f64 }
|
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl Debug for f16 {
|
impl Debug for f16 {
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
use crate::fmt::{Debug, Formatter, Result};
|
use crate::fmt::{Debug, Formatter, Result};
|
||||||
|
|
||||||
macro_rules! floating {
|
macro_rules! floating {
|
||||||
($ty:ident) => {
|
($($ty:ident)*) => {
|
||||||
|
$(
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl Debug for $ty {
|
impl Debug for $ty {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, _fmt: &mut Formatter<'_>) -> Result {
|
fn fmt(&self, _fmt: &mut Formatter<'_>) -> Result {
|
||||||
panic!("floating point support is turned off");
|
panic!("floating point fmt support is turned off");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
)*
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
floating! { f16 }
|
floating! { f16 f32 f64 f128 }
|
||||||
floating! { f32 }
|
|
||||||
floating! { f64 }
|
|
||||||
floating! { f128 }
|
|
||||||
|
@ -169,7 +169,8 @@ integer! { i64, u64 }
|
|||||||
integer! { i128, u128 }
|
integer! { i128, u128 }
|
||||||
|
|
||||||
macro_rules! impl_Debug {
|
macro_rules! impl_Debug {
|
||||||
($($T:ident)*) => {$(
|
($($T:ident)*) => {
|
||||||
|
$(
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl fmt::Debug for $T {
|
impl fmt::Debug for $T {
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -183,7 +184,8 @@ macro_rules! impl_Debug {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)*};
|
)*
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2 digit decimal look up table
|
// 2 digit decimal look up table
|
||||||
|
Loading…
x
Reference in New Issue
Block a user