Skip to content

Commit 83eda08

Browse files
committed
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.
2 parents 45a73c8 + c4230ea commit 83eda08

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/libcore/num/dec2flt/mod.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ use fmt;
9797
use str::FromStr;
9898

9999
use self::parse::{parse_decimal, Decimal, Sign};
100-
use self::parse::ParseResult::{self, Valid, ShortcutToInf, ShortcutToZero};
100+
use self::parse::ParseResult::{Valid, Invalid, ShortcutToInf, ShortcutToZero};
101101
use self::num::digits_to_big;
102102
use self::rawfp::RawFloat;
103103

@@ -109,7 +109,7 @@ pub mod rawfp;
109109
pub mod parse;
110110

111111
macro_rules! from_str_float_impl {
112-
($t:ty, $func:ident) => {
112+
($t:ty) => {
113113
#[stable(feature = "rust1", since = "1.0.0")]
114114
impl FromStr for $t {
115115
type Err = ParseFloatError;
@@ -146,8 +146,8 @@ macro_rules! from_str_float_impl {
146146
}
147147
}
148148
}
149-
from_str_float_impl!(f32, to_f32);
150-
from_str_float_impl!(f64, to_f64);
149+
from_str_float_impl!(f32);
150+
from_str_float_impl!(f64);
151151

152152
/// An error which can be returned when parsing a float.
153153
#[derive(Debug, Clone, PartialEq)]
@@ -183,11 +183,11 @@ impl fmt::Display for ParseFloatError {
183183
}
184184
}
185185

186-
pub fn pfe_empty() -> ParseFloatError {
186+
fn pfe_empty() -> ParseFloatError {
187187
ParseFloatError { kind: FloatErrorKind::Empty }
188188
}
189189

190-
pub fn pfe_invalid() -> ParseFloatError {
190+
fn pfe_invalid() -> ParseFloatError {
191191
ParseFloatError { kind: FloatErrorKind::Invalid }
192192
}
193193

@@ -211,7 +211,7 @@ fn dec2flt<T: RawFloat>(s: &str) -> Result<T, ParseFloatError> {
211211
Valid(decimal) => try!(convert(decimal)),
212212
ShortcutToInf => T::infinity(),
213213
ShortcutToZero => T::zero(),
214-
ParseResult::Invalid => match s {
214+
Invalid => match s {
215215
"inf" => T::infinity(),
216216
"NaN" => T::nan(),
217217
_ => { return Err(pfe_invalid()); }

src/libcore/num/dec2flt/rawfp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ pub fn encode_normal<T: RawFloat>(x: Unpacked) -> T {
288288
/// Construct the subnormal. A mantissa of 0 is allowed and constructs zero.
289289
pub fn encode_subnormal<T: RawFloat>(significand: u64) -> T {
290290
assert!(significand < T::min_sig(), "encode_subnormal: not actually subnormal");
291-
// Êncoded exponent is 0, the sign bit is 0, so we just have to reinterpret the bits.
291+
// Encoded exponent is 0, the sign bit is 0, so we just have to reinterpret the bits.
292292
T::from_bits(significand)
293293
}
294294

0 commit comments

Comments
 (0)