From 6d87929bcb19da2f0490c1e39533ab0794c5f38d Mon Sep 17 00:00:00 2001 From: Robin Kruppe Date: Sat, 12 Dec 2015 00:06:05 +0100 Subject: [PATCH 1/3] Remove an accent in a comment --- src/libcore/num/dec2flt/rawfp.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs index be61653c37937..197589740032a 100644 --- a/src/libcore/num/dec2flt/rawfp.rs +++ b/src/libcore/num/dec2flt/rawfp.rs @@ -288,7 +288,7 @@ pub fn encode_normal(x: Unpacked) -> T { /// Construct the subnormal. A mantissa of 0 is allowed and constructs zero. pub fn encode_subnormal(significand: u64) -> T { assert!(significand < T::min_sig(), "encode_subnormal: not actually subnormal"); - // Êncoded exponent is 0, the sign bit is 0, so we just have to reinterpret the bits. + // Encoded exponent is 0, the sign bit is 0, so we just have to reinterpret the bits. T::from_bits(significand) } From 2863a8ba7a71f2ff1190fd02d2ff673521bd8a39 Mon Sep 17 00:00:00 2001 From: Robin Kruppe Date: Sat, 12 Dec 2015 00:07:42 +0100 Subject: [PATCH 2/3] dec2flt: Simplify imports and module surface The import has been unnecessarily complicated since ParseFloatError::Invalid is not longer used unqualified. The pfe_* functions do not need to be public any more since the only other use site, from_str_radix for floats, has been removed. --- src/libcore/num/dec2flt/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index 55be4cd31910b..7b01b950d63c3 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -97,7 +97,7 @@ use fmt; use str::FromStr; use self::parse::{parse_decimal, Decimal, Sign}; -use self::parse::ParseResult::{self, Valid, ShortcutToInf, ShortcutToZero}; +use self::parse::ParseResult::{Valid, Invalid, ShortcutToInf, ShortcutToZero}; use self::num::digits_to_big; use self::rawfp::RawFloat; @@ -183,11 +183,11 @@ impl fmt::Display for ParseFloatError { } } -pub fn pfe_empty() -> ParseFloatError { +fn pfe_empty() -> ParseFloatError { ParseFloatError { kind: FloatErrorKind::Empty } } -pub fn pfe_invalid() -> ParseFloatError { +fn pfe_invalid() -> ParseFloatError { ParseFloatError { kind: FloatErrorKind::Invalid } } @@ -211,7 +211,7 @@ fn dec2flt(s: &str) -> Result { Valid(decimal) => try!(convert(decimal)), ShortcutToInf => T::infinity(), ShortcutToZero => T::zero(), - ParseResult::Invalid => match s { + Invalid => match s { "inf" => T::infinity(), "NaN" => T::nan(), _ => { return Err(pfe_invalid()); } From c4230ea50c4a781ce515bd0c8874b3d181a729b3 Mon Sep 17 00:00:00 2001 From: Robin Kruppe Date: Sat, 12 Dec 2015 00:10:15 +0100 Subject: [PATCH 3/3] dec2flt: Remove unused macro argument The argument was a remnant of an earlier, needlessly complicated implementation. --- src/libcore/num/dec2flt/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index 7b01b950d63c3..9c0ec0f22c50f 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -109,7 +109,7 @@ pub mod rawfp; pub mod parse; macro_rules! from_str_float_impl { - ($t:ty, $func:ident) => { + ($t:ty) => { #[stable(feature = "rust1", since = "1.0.0")] impl FromStr for $t { type Err = ParseFloatError; @@ -146,8 +146,8 @@ macro_rules! from_str_float_impl { } } } -from_str_float_impl!(f32, to_f32); -from_str_float_impl!(f64, to_f64); +from_str_float_impl!(f32); +from_str_float_impl!(f64); /// An error which can be returned when parsing a float. #[derive(Debug, Clone, PartialEq)]