diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-01-01 23:53:35 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-01-03 23:43:57 -0800 |
| commit | 7d8d06f86b48520814596bd5363d2b82bc619774 (patch) | |
| tree | eda093ca208286fd8679da8de9f3597b7a024c50 /src/libcoretest/num | |
| parent | 470118f3e915cdc8f936aca0640b28a7a3d8dc6c (diff) | |
| download | rust-7d8d06f86b48520814596bd5363d2b82bc619774.tar.gz rust-7d8d06f86b48520814596bd5363d2b82bc619774.zip | |
Remove deprecated functionality
This removes a large array of deprecated functionality, regardless of how recently it was deprecated. The purpose of this commit is to clean out the standard libraries and compiler for the upcoming alpha release. Some notable compiler changes were to enable warnings for all now-deprecated command line arguments (previously the deprecated versions were silently accepted) as well as removing deriving(Zero) entirely (the trait was removed). The distribution no longer contains the libtime or libregex_macros crates. Both of these have been deprecated for some time and are available externally.
Diffstat (limited to 'src/libcoretest/num')
| -rw-r--r-- | src/libcoretest/num/int_macros.rs | 4 | ||||
| -rw-r--r-- | src/libcoretest/num/mod.rs | 34 |
2 files changed, 19 insertions, 19 deletions
diff --git a/src/libcoretest/num/int_macros.rs b/src/libcoretest/num/int_macros.rs index e409dc61510..8885d3a5208 100644 --- a/src/libcoretest/num/int_macros.rs +++ b/src/libcoretest/num/int_macros.rs @@ -16,7 +16,6 @@ mod tests { use core::$T_i::*; use core::int; use core::num::{FromStrRadix, Int, SignedInt}; - use core::str::from_str; use core::ops::{Shl, Shr, Not, BitXor, BitAnd, BitOr}; use num; @@ -161,6 +160,9 @@ mod tests { #[test] fn test_from_str() { + fn from_str<T: ::std::str::FromStr>(t: &str) -> Option<T> { + ::std::str::FromStr::from_str(t) + } assert_eq!(from_str::<$T>("0"), Some(0 as $T)); assert_eq!(from_str::<$T>("3"), Some(3 as $T)); assert_eq!(from_str::<$T>("10"), Some(10 as $T)); diff --git a/src/libcoretest/num/mod.rs b/src/libcoretest/num/mod.rs index 274b4cee3ba..651e8640e91 100644 --- a/src/libcoretest/num/mod.rs +++ b/src/libcoretest/num/mod.rs @@ -13,7 +13,6 @@ use core::fmt::Show; use core::num::{NumCast, cast}; use core::ops::{Add, Sub, Mul, Div, Rem}; use core::kinds::Copy; -use std::str::from_str; mod int_macros; mod i8; @@ -55,7 +54,6 @@ mod test { use core::option::Option::{Some, None}; use core::num::Float; use core::num::from_str_radix; - use core::str::from_str; #[test] fn from_str_issue7588() { @@ -88,35 +86,35 @@ mod test { #[test] fn test_int_from_str_overflow() { let mut i8_val: i8 = 127_i8; - assert_eq!(from_str::<i8>("127"), Some(i8_val)); - assert_eq!(from_str::<i8>("128"), None); + assert_eq!("127".parse::<i8>(), Some(i8_val)); + assert_eq!("128".parse::<i8>(), None); i8_val += 1 as i8; - assert_eq!(from_str::<i8>("-128"), Some(i8_val)); - assert_eq!(from_str::<i8>("-129"), None); + assert_eq!("-128".parse::<i8>(), Some(i8_val)); + assert_eq!("-129".parse::<i8>(), None); let mut i16_val: i16 = 32_767_i16; - assert_eq!(from_str::<i16>("32767"), Some(i16_val)); - assert_eq!(from_str::<i16>("32768"), None); + assert_eq!("32767".parse::<i16>(), Some(i16_val)); + assert_eq!("32768".parse::<i16>(), None); i16_val += 1 as i16; - assert_eq!(from_str::<i16>("-32768"), Some(i16_val)); - assert_eq!(from_str::<i16>("-32769"), None); + assert_eq!("-32768".parse::<i16>(), Some(i16_val)); + assert_eq!("-32769".parse::<i16>(), None); let mut i32_val: i32 = 2_147_483_647_i32; - assert_eq!(from_str::<i32>("2147483647"), Some(i32_val)); - assert_eq!(from_str::<i32>("2147483648"), None); + assert_eq!("2147483647".parse::<i32>(), Some(i32_val)); + assert_eq!("2147483648".parse::<i32>(), None); i32_val += 1 as i32; - assert_eq!(from_str::<i32>("-2147483648"), Some(i32_val)); - assert_eq!(from_str::<i32>("-2147483649"), None); + assert_eq!("-2147483648".parse::<i32>(), Some(i32_val)); + assert_eq!("-2147483649".parse::<i32>(), None); let mut i64_val: i64 = 9_223_372_036_854_775_807_i64; - assert_eq!(from_str::<i64>("9223372036854775807"), Some(i64_val)); - assert_eq!(from_str::<i64>("9223372036854775808"), None); + assert_eq!("9223372036854775807".parse::<i64>(), Some(i64_val)); + assert_eq!("9223372036854775808".parse::<i64>(), None); i64_val += 1 as i64; - assert_eq!(from_str::<i64>("-9223372036854775808"), Some(i64_val)); - assert_eq!(from_str::<i64>("-9223372036854775809"), None); + assert_eq!("-9223372036854775808".parse::<i64>(), Some(i64_val)); + assert_eq!("-9223372036854775809".parse::<i64>(), None); } } |
