about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-12-12 18:02:43 +0000
committerbors <bors@rust-lang.org>2015-12-12 18:02:43 +0000
commit83eda080373285d3cbe4ca0ee280e4844c6422a3 (patch)
treed634a34c1ae158fe9cfeb6ebe8c0c2ea62b4e3af /src/libcore
parent45a73c8c0cf2d5a181be2c1e927212975e0cffc7 (diff)
parentc4230ea50c4a781ce515bd0c8874b3d181a729b3 (diff)
downloadrust-83eda080373285d3cbe4ca0ee280e4844c6422a3.tar.gz
rust-83eda080373285d3cbe4ca0ee280e4844c6422a3.zip
Auto merge of #30347 - rkruppe:misc-dec2flt-cleanup, r=alexcrichton
The landing of #30182, specifically the removal of float `from_str_radix`, allowed the refactoring in the middle commit. While I was at it, I also crossed two other nits off my TODO list.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/num/dec2flt/mod.rs14
-rw-r--r--src/libcore/num/dec2flt/rawfp.rs2
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs
index 55be4cd3191..9c0ec0f22c5 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;
 
@@ -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)]
@@ -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<T: RawFloat>(s: &str) -> Result<T, ParseFloatError> {
         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()); }
diff --git a/src/libcore/num/dec2flt/rawfp.rs b/src/libcore/num/dec2flt/rawfp.rs
index be61653c379..19758974003 100644
--- a/src/libcore/num/dec2flt/rawfp.rs
+++ b/src/libcore/num/dec2flt/rawfp.rs
@@ -288,7 +288,7 @@ pub fn encode_normal<T: RawFloat>(x: Unpacked) -> T {
 /// Construct the subnormal. A mantissa of 0 is allowed and constructs zero.
 pub fn encode_subnormal<T: RawFloat>(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)
 }