Skip to content

Commit 68bd495

Browse files
committed
Remove core::num::strconv
1 parent 29bc9c6 commit 68bd495

File tree

6 files changed

+282
-411
lines changed

6 files changed

+282
-411
lines changed

src/libcore/num/f32.rs

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616

1717
use intrinsics;
1818
use mem;
19-
use num::{FPNormal, FPCategory, FPZero, FPSubnormal, FPInfinite, FPNaN};
20-
use num::{Float, FromStrRadix};
21-
use num::strconv;
22-
use str::FromStr;
19+
use num::{Float, FPNormal, FPCategory, FPZero, FPSubnormal, FPInfinite, FPNaN};
20+
use num::from_str_radix;
2321
use option::Option;
2422

2523
pub const RADIX: uint = 2u;
@@ -431,61 +429,5 @@ impl Float for f32 {
431429
#[allow(missing_docs)]
432430
#[deprecated="Use `FromStrRadix::from_str_radix(src, 16)`"]
433431
pub fn from_str_hex(src: &str) -> Option<f32> {
434-
strconv::from_str_radix_float(src, 16)
435-
}
436-
437-
impl FromStr for f32 {
438-
/// Convert a string in base 10 to a float.
439-
/// Accepts an optional decimal exponent.
440-
///
441-
/// This function accepts strings such as
442-
///
443-
/// * '3.14'
444-
/// * '+3.14', equivalent to '3.14'
445-
/// * '-3.14'
446-
/// * '2.5E10', or equivalently, '2.5e10'
447-
/// * '2.5E-10'
448-
/// * '.' (understood as 0)
449-
/// * '5.'
450-
/// * '.5', or, equivalently, '0.5'
451-
/// * '+inf', 'inf', '-inf', 'NaN'
452-
///
453-
/// Leading and trailing whitespace represent an error.
454-
///
455-
/// # Arguments
456-
///
457-
/// * src - A string
458-
///
459-
/// # Return value
460-
///
461-
/// `None` if the string did not represent a valid number. Otherwise,
462-
/// `Some(n)` where `n` is the floating-point number represented by `src`.
463-
#[inline]
464-
fn from_str(src: &str) -> Option<f32> {
465-
strconv::from_str_radix_float(src, 10u)
466-
}
467-
}
468-
469-
impl FromStrRadix for f32 {
470-
/// Convert a string in a given base to a float.
471-
///
472-
/// Due to possible conflicts, this function does **not** accept
473-
/// the special values `inf`, `-inf`, `+inf` and `NaN`, **nor**
474-
/// does it recognize exponents of any kind.
475-
///
476-
/// Leading and trailing whitespace represent an error.
477-
///
478-
/// # Arguments
479-
///
480-
/// * src - A string
481-
/// * radix - The base to use. Must lie in the range [2 .. 36]
482-
///
483-
/// # Return value
484-
///
485-
/// `None` if the string did not represent a valid number. Otherwise,
486-
/// `Some(n)` where `n` is the floating-point number represented by `src`.
487-
#[inline]
488-
fn from_str_radix(src: &str, radix: uint) -> Option<f32> {
489-
strconv::from_str_radix_float(src, radix)
490-
}
432+
from_str_radix(src, 16)
491433
}

src/libcore/num/f64.rs

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616

1717
use intrinsics;
1818
use mem;
19-
use num::{FPNormal, FPCategory, FPZero, FPSubnormal, FPInfinite, FPNaN};
20-
use num::{Float, FromStrRadix};
21-
use num::strconv;
22-
use str::FromStr;
19+
use num::{Float, FPNormal, FPCategory, FPZero, FPSubnormal, FPInfinite, FPNaN};
20+
use num::from_str_radix;
2321
use option::Option;
2422

2523
// FIXME(#5527): These constants should be deprecated once associated
@@ -437,56 +435,5 @@ impl Float for f64 {
437435
#[allow(missing_docs)]
438436
#[deprecated="Use `FromStrRadix::from_str_radix(src, 16)`"]
439437
pub fn from_str_hex(src: &str) -> Option<f64> {
440-
strconv::from_str_radix_float(src, 16)
441-
}
442-
443-
impl FromStr for f64 {
444-
/// Convert a string in base 10 to a float.
445-
/// Accepts an optional decimal exponent.
446-
///
447-
/// This function accepts strings such as:
448-
///
449-
/// * '3.14'
450-
/// * '-3.14'
451-
/// * '2.5E10', or equivalently, '2.5e10'
452-
/// * '2.5E-10'
453-
/// * '.' (understood as 0)
454-
/// * '5.'
455-
/// * '.5', or, equivalently, '0.5'
456-
/// * inf', '-inf', 'NaN'
457-
///
458-
/// Leading and trailing whitespace represent an error.
459-
///
460-
/// # Arguments
461-
///
462-
/// * src - A string
463-
///
464-
/// # Return value
465-
///
466-
/// `none` if the string did not represent a valid number. Otherwise,
467-
/// `Some(n)` where `n` is the floating-point number represented by `src`.
468-
#[inline]
469-
fn from_str(src: &str) -> Option<f64> {
470-
strconv::from_str_radix_float(src, 10u)
471-
}
472-
}
473-
474-
impl FromStrRadix for f64 {
475-
/// Convert a string in a given base to a float.
476-
///
477-
/// Leading and trailing whitespace represent an error.
478-
///
479-
/// # Arguments
480-
///
481-
/// * src - A string
482-
/// * radix - The base to use. Must lie in the range [2 .. 36]
483-
///
484-
/// # Return value
485-
///
486-
/// `None` if the string did not represent a valid number. Otherwise,
487-
/// `Some(n)` where `n` is the floating-point number represented by `src`.
488-
#[inline]
489-
fn from_str_radix(src: &str, radix: uint) -> Option<f64> {
490-
strconv::from_str_radix_float(src, radix)
491-
}
438+
from_str_radix(src, 16)
492439
}

src/libcore/num/int_macros.rs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,4 @@ pub const MIN: $T = (-1 as $T) << (BITS - 1);
3232
#[unstable]
3333
pub const MAX: $T = !MIN;
3434

35-
#[experimental = "might need to return Result"]
36-
impl ::str::FromStr for $T {
37-
#[inline]
38-
fn from_str(s: &str) -> ::option::Option<$T> {
39-
::num::strconv::from_str_radix_int(s, 10)
40-
}
41-
}
42-
43-
#[experimental = "might need to return Result"]
44-
impl ::num::FromStrRadix for $T {
45-
#[inline]
46-
fn from_str_radix(s: &str, radix: uint) -> ::option::Option<$T> {
47-
::num::strconv::from_str_radix_int(s, radix)
48-
}
49-
}
50-
5135
))

0 commit comments

Comments
 (0)