libcore: deny more...
This commit is contained in:
parent
5d20ff4d27
commit
dbfbadeac4
37 changed files with 233 additions and 236 deletions
|
|
@ -5,13 +5,13 @@ use crate::num::flt2dec;
|
|||
// Don't inline this so callers don't use the stack space this function
|
||||
// requires unless they have to.
|
||||
#[inline(never)]
|
||||
fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
|
||||
fn float_to_decimal_common_exact<T>(fmt: &mut Formatter<'_>, num: &T,
|
||||
sign: flt2dec::Sign, precision: usize) -> Result
|
||||
where T: flt2dec::DecodableFloat
|
||||
{
|
||||
unsafe {
|
||||
let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64
|
||||
let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninit();
|
||||
let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 4]>::uninit();
|
||||
// FIXME(#53491): Technically, this is calling `get_mut` on an uninitialized
|
||||
// `MaybeUninit` (here and elsewhere in this file). Revisit this once
|
||||
// we decided whether that is valid or not.
|
||||
|
|
@ -26,14 +26,14 @@ fn float_to_decimal_common_exact<T>(fmt: &mut Formatter, num: &T,
|
|||
// Don't inline this so callers that call both this and the above won't wind
|
||||
// up using the combined stack space of both functions in some cases.
|
||||
#[inline(never)]
|
||||
fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter, num: &T,
|
||||
fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter<'_>, num: &T,
|
||||
sign: flt2dec::Sign, precision: usize) -> Result
|
||||
where T: flt2dec::DecodableFloat
|
||||
{
|
||||
unsafe {
|
||||
// enough for f32 and f64
|
||||
let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninit();
|
||||
let mut parts = MaybeUninit::<[flt2dec::Part; 4]>::uninit();
|
||||
let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 4]>::uninit();
|
||||
// FIXME(#53491)
|
||||
let formatted = flt2dec::to_shortest_str(flt2dec::strategy::grisu::format_shortest, *num,
|
||||
sign, precision, false, buf.get_mut(),
|
||||
|
|
@ -43,7 +43,7 @@ fn float_to_decimal_common_shortest<T>(fmt: &mut Formatter, num: &T,
|
|||
}
|
||||
|
||||
// Common code of floating point Debug and Display.
|
||||
fn float_to_decimal_common<T>(fmt: &mut Formatter, num: &T,
|
||||
fn float_to_decimal_common<T>(fmt: &mut Formatter<'_>, num: &T,
|
||||
negative_zero: bool, min_precision: usize) -> Result
|
||||
where T: flt2dec::DecodableFloat
|
||||
{
|
||||
|
|
@ -65,14 +65,14 @@ fn float_to_decimal_common<T>(fmt: &mut Formatter, num: &T,
|
|||
// Don't inline this so callers don't use the stack space this function
|
||||
// requires unless they have to.
|
||||
#[inline(never)]
|
||||
fn float_to_exponential_common_exact<T>(fmt: &mut Formatter, num: &T,
|
||||
fn float_to_exponential_common_exact<T>(fmt: &mut Formatter<'_>, num: &T,
|
||||
sign: flt2dec::Sign, precision: usize,
|
||||
upper: bool) -> Result
|
||||
where T: flt2dec::DecodableFloat
|
||||
{
|
||||
unsafe {
|
||||
let mut buf = MaybeUninit::<[u8; 1024]>::uninit(); // enough for f32 and f64
|
||||
let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninit();
|
||||
let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 6]>::uninit();
|
||||
// FIXME(#53491)
|
||||
let formatted = flt2dec::to_exact_exp_str(flt2dec::strategy::grisu::format_exact,
|
||||
*num, sign, precision,
|
||||
|
|
@ -84,7 +84,7 @@ fn float_to_exponential_common_exact<T>(fmt: &mut Formatter, num: &T,
|
|||
// Don't inline this so callers that call both this and the above won't wind
|
||||
// up using the combined stack space of both functions in some cases.
|
||||
#[inline(never)]
|
||||
fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
|
||||
fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter<'_>,
|
||||
num: &T, sign: flt2dec::Sign,
|
||||
upper: bool) -> Result
|
||||
where T: flt2dec::DecodableFloat
|
||||
|
|
@ -92,7 +92,7 @@ fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
|
|||
unsafe {
|
||||
// enough for f32 and f64
|
||||
let mut buf = MaybeUninit::<[u8; flt2dec::MAX_SIG_DIGITS]>::uninit();
|
||||
let mut parts = MaybeUninit::<[flt2dec::Part; 6]>::uninit();
|
||||
let mut parts = MaybeUninit::<[flt2dec::Part<'_>; 6]>::uninit();
|
||||
// FIXME(#53491)
|
||||
let formatted = flt2dec::to_shortest_exp_str(flt2dec::strategy::grisu::format_shortest,
|
||||
*num, sign, (0, 0), upper,
|
||||
|
|
@ -102,7 +102,7 @@ fn float_to_exponential_common_shortest<T>(fmt: &mut Formatter,
|
|||
}
|
||||
|
||||
// Common code of floating point LowerExp and UpperExp.
|
||||
fn float_to_exponential_common<T>(fmt: &mut Formatter, num: &T, upper: bool) -> Result
|
||||
fn float_to_exponential_common<T>(fmt: &mut Formatter<'_>, num: &T, upper: bool) -> Result
|
||||
where T: flt2dec::DecodableFloat
|
||||
{
|
||||
let force_sign = fmt.sign_plus();
|
||||
|
|
@ -123,28 +123,28 @@ macro_rules! floating {
|
|||
($ty:ident) => (
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Debug for $ty {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
|
||||
float_to_decimal_common(fmt, self, true, 1)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl Display for $ty {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
|
||||
float_to_decimal_common(fmt, self, false, 0)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl LowerExp for $ty {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
|
||||
float_to_exponential_common(fmt, self, false)
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl UpperExp for $ty {
|
||||
fn fmt(&self, fmt: &mut Formatter) -> Result {
|
||||
fn fmt(&self, fmt: &mut Formatter<'_>) -> Result {
|
||||
float_to_exponential_common(fmt, self, true)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue