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 | |
| parent | 5d20ff4d2718c820632b38c1e49d4de648a9810b (diff) | |
| download | rust-dbfbadeac4f593e31bbcb57bc7c3b1d17ab1cd65.tar.gz rust-dbfbadeac4f593e31bbcb57bc7c3b1d17ab1cd65.zip | |
libcore: deny more...
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/bignum.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/dec2flt/mod.rs | 10 | ||||
| -rw-r--r-- | src/libcore/num/dec2flt/parse.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 18 |
4 files changed, 16 insertions, 16 deletions
diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs index 64699e85d0c..342ac69748d 100644 --- a/src/libcore/num/bignum.rs +++ b/src/libcore/num/bignum.rs @@ -459,7 +459,7 @@ macro_rules! define_bignum { } impl crate::fmt::Debug for $name { - fn fmt(&self, f: &mut crate::fmt::Formatter) -> crate::fmt::Result { + fn fmt(&self, f: &mut crate::fmt::Formatter<'_>) -> crate::fmt::Result { use crate::mem; let sz = if self.size < 1 {1} else {self.size}; 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; } diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 24afc945e93..c8a4ff7ca61 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -15,7 +15,7 @@ macro_rules! impl_nonzero_fmt { #[$stability] impl fmt::$Trait for $Ty { #[inline] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.get().fmt(f) } } @@ -164,42 +164,42 @@ pub struct Wrapping<T>(#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")] impl<T: fmt::Debug> fmt::Debug for Wrapping<T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_display", since = "1.10.0")] impl<T: fmt::Display> fmt::Display for Wrapping<T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_fmt", since = "1.11.0")] impl<T: fmt::Binary> fmt::Binary for Wrapping<T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_fmt", since = "1.11.0")] impl<T: fmt::Octal> fmt::Octal for Wrapping<T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_fmt", since = "1.11.0")] impl<T: fmt::LowerHex> fmt::LowerHex for Wrapping<T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } #[stable(feature = "wrapping_fmt", since = "1.11.0")] impl<T: fmt::UpperHex> fmt::UpperHex for Wrapping<T> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.0.fmt(f) } } @@ -4423,7 +4423,7 @@ impl TryFromIntError { #[stable(feature = "try_from", since = "1.34.0")] impl fmt::Display for TryFromIntError { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { self.__description().fmt(fmt) } } @@ -4820,7 +4820,7 @@ impl ParseIntError { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Display for ParseIntError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { self.__description().fmt(f) } } |
