diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-04-19 01:37:12 +0200 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-04-19 01:37:12 +0200 |
| commit | dbfbadeac4f593e31bbcb57bc7c3b1d17ab1cd65 (patch) | |
| tree | 0145cabc176d4046b0b4dc8f50b203a2e9a37e0d /src/libcore/num/dec2flt | |
| parent | 5d20ff4d2718c820632b38c1e49d4de648a9810b (diff) | |
| download | rust-dbfbadeac4f593e31bbcb57bc7c3b1d17ab1cd65.tar.gz rust-dbfbadeac4f593e31bbcb57bc7c3b1d17ab1cd65.zip | |
libcore: deny more...
Diffstat (limited to 'src/libcore/num/dec2flt')
| -rw-r--r-- | src/libcore/num/dec2flt/mod.rs | 10 | ||||
| -rw-r--r-- | src/libcore/num/dec2flt/parse.rs | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index dcfa2d352a8..4536bbc94ad 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -196,7 +196,7 @@ impl ParseFloatError { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for ParseFloatError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.__description().fmt(f) } } @@ -244,7 +244,7 @@ fn dec2flt<T: RawFloat>(s: &str) -> Result<T, ParseFloatError> { /// The main workhorse for the decimal-to-float conversion: Orchestrate all the preprocessing /// and figure out which algorithm should do the actual conversion. -fn convert<T: RawFloat>(mut decimal: Decimal) -> Result<T, ParseFloatError> { +fn convert<T: RawFloat>(mut decimal: Decimal<'_>) -> Result<T, ParseFloatError> { simplify(&mut decimal); if let Some(x) = trivial_cases(&decimal) { return Ok(x); @@ -281,7 +281,7 @@ fn convert<T: RawFloat>(mut decimal: Decimal) -> Result<T, ParseFloatError> { /// Strip zeros where possible, even when this requires changing the exponent #[inline(always)] -fn simplify(decimal: &mut Decimal) { +fn simplify(decimal: &mut Decimal<'_>) { let is_zero = &|&&d: &&u8| -> bool { d == b'0' }; // Trimming these zeros does not change anything but may enable the fast path (< 15 digits). let leading_zeros = decimal.integral.iter().take_while(is_zero).count(); @@ -306,7 +306,7 @@ fn simplify(decimal: &mut Decimal) { /// Returns a quick-an-dirty upper bound on the size (log10) of the largest value that Algorithm R /// and Algorithm M will compute while working on the given decimal. -fn bound_intermediate_digits(decimal: &Decimal, e: i64) -> u64 { +fn bound_intermediate_digits(decimal: &Decimal<'_>, e: i64) -> u64 { // We don't need to worry too much about overflow here thanks to trivial_cases() and the // parser, which filter out the most extreme inputs for us. let f_len: u64 = decimal.integral.len() as u64 + decimal.fractional.len() as u64; @@ -325,7 +325,7 @@ fn bound_intermediate_digits(decimal: &Decimal, e: i64) -> u64 { } /// Detects obvious overflows and underflows without even looking at the decimal digits. -fn trivial_cases<T: RawFloat>(decimal: &Decimal) -> Option<T> { +fn trivial_cases<T: RawFloat>(decimal: &Decimal<'_>) -> Option<T> { // There were zeros but they were stripped by simplify() if decimal.integral.is_empty() && decimal.fractional.is_empty() { return Some(T::ZERO); diff --git a/src/libcore/num/dec2flt/parse.rs b/src/libcore/num/dec2flt/parse.rs index f970595452e..cf3664a8748 100644 --- a/src/libcore/num/dec2flt/parse.rs +++ b/src/libcore/num/dec2flt/parse.rs @@ -44,7 +44,7 @@ pub enum ParseResult<'a> { /// Checks if the input string is a valid floating point number and if so, locate the integral /// part, the fractional part, and the exponent in it. Does not handle signs. -pub fn parse_decimal(s: &str) -> ParseResult { +pub fn parse_decimal(s: &str) -> ParseResult<'_> { if s.is_empty() { return Invalid; } |
