Skip to content

Commit

Permalink
dec2flt: Simplify imports and module surface
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Robin Kruppe committed Dec 11, 2015
1 parent 6d87929 commit 2863a8b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libcore/num/dec2flt/mod.rs
Expand Up @@ -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;

Expand Down Expand Up @@ -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 }
}

Expand All @@ -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()); }
Expand Down

0 comments on commit 2863a8b

Please sign in to comment.