about summary refs log tree commit diff
path: root/src/libcoretest
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-01 23:53:35 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-03 23:43:57 -0800
commit7d8d06f86b48520814596bd5363d2b82bc619774 (patch)
treeeda093ca208286fd8679da8de9f3597b7a024c50 /src/libcoretest
parent470118f3e915cdc8f936aca0640b28a7a3d8dc6c (diff)
downloadrust-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')
-rw-r--r--src/libcoretest/char.rs62
-rw-r--r--src/libcoretest/iter.rs2
-rw-r--r--src/libcoretest/nonzero.rs2
-rw-r--r--src/libcoretest/num/int_macros.rs4
-rw-r--r--src/libcoretest/num/mod.rs34
-rw-r--r--src/libcoretest/ptr.rs9
-rw-r--r--src/libcoretest/str.rs10
7 files changed, 57 insertions, 66 deletions
diff --git a/src/libcoretest/char.rs b/src/libcoretest/char.rs
index b931809e603..b581cdbd710 100644
--- a/src/libcoretest/char.rs
+++ b/src/libcoretest/char.rs
@@ -10,8 +10,6 @@
 //
 // ignore-lexer-test FIXME #15679
 
-use core::char::{escape_unicode, escape_default};
-
 #[test]
 fn test_is_lowercase() {
     assert!('a'.is_lowercase());
@@ -33,12 +31,12 @@ fn test_is_uppercase() {
 #[test]
 fn test_is_whitespace() {
     assert!(' '.is_whitespace());
-    assert!('\u2007'.is_whitespace());
+    assert!('\u{2007}'.is_whitespace());
     assert!('\t'.is_whitespace());
     assert!('\n'.is_whitespace());
     assert!(!'a'.is_whitespace());
     assert!(!'_'.is_whitespace());
-    assert!(!'\u0000'.is_whitespace());
+    assert!(!'\u{0}'.is_whitespace());
 }
 
 #[test]
@@ -92,15 +90,15 @@ fn test_to_uppercase() {
 
 #[test]
 fn test_is_control() {
-    assert!('\u0000'.is_control());
-    assert!('\u0003'.is_control());
-    assert!('\u0006'.is_control());
-    assert!('\u0009'.is_control());
-    assert!('\u007f'.is_control());
-    assert!('\u0092'.is_control());
-    assert!(!'\u0020'.is_control());
-    assert!(!'\u0055'.is_control());
-    assert!(!'\u0068'.is_control());
+    assert!('\u{0}'.is_control());
+    assert!('\u{3}'.is_control());
+    assert!('\u{6}'.is_control());
+    assert!('\u{9}'.is_control());
+    assert!('\u{7f}'.is_control());
+    assert!('\u{92}'.is_control());
+    assert!(!'\u{20}'.is_control());
+    assert!(!'\u{55}'.is_control());
+    assert!(!'\u{68}'.is_control());
 }
 
 #[test]
@@ -116,9 +114,7 @@ fn test_is_digit() {
 #[test]
 fn test_escape_default() {
     fn string(c: char) -> String {
-        let mut result = String::new();
-        escape_default(c, |c| { result.push(c); });
-        return result;
+        c.escape_default().collect()
     }
     let s = string('\n');
     assert_eq!(s, "\\n");
@@ -175,9 +171,9 @@ fn test_encode_utf8() {
     }
 
     check('x', &[0x78]);
-    check('\u00e9', &[0xc3, 0xa9]);
-    check('\ua66e', &[0xea, 0x99, 0xae]);
-    check('\U0001f4a9', &[0xf0, 0x9f, 0x92, 0xa9]);
+    check('\u{e9}', &[0xc3, 0xa9]);
+    check('\u{a66e}', &[0xea, 0x99, 0xae]);
+    check('\u{1f4a9}', &[0xf0, 0x9f, 0x92, 0xa9]);
 }
 
 #[test]
@@ -189,17 +185,17 @@ fn test_encode_utf16() {
     }
 
     check('x', &[0x0078]);
-    check('\u00e9', &[0x00e9]);
-    check('\ua66e', &[0xa66e]);
-    check('\U0001f4a9', &[0xd83d, 0xdca9]);
+    check('\u{e9}', &[0x00e9]);
+    check('\u{a66e}', &[0xa66e]);
+    check('\u{1f4a9}', &[0xd83d, 0xdca9]);
 }
 
 #[test]
 fn test_len_utf16() {
     assert!('x'.len_utf16() == 1);
-    assert!('\u00e9'.len_utf16() == 1);
-    assert!('\ua66e'.len_utf16() == 1);
-    assert!('\U0001f4a9'.len_utf16() == 2);
+    assert!('\u{e9}'.len_utf16() == 1);
+    assert!('\u{a66e}'.len_utf16() == 1);
+    assert!('\u{1f4a9}'.len_utf16() == 2);
 }
 
 #[test]
@@ -216,15 +212,15 @@ fn test_width() {
     assert_eq!('h'.width(false),Some(2));
     assert_eq!('h'.width(true),Some(2));
 
-    assert_eq!('\u00AD'.width(false),Some(1));
-    assert_eq!('\u00AD'.width(true),Some(1));
+    assert_eq!('\u{AD}'.width(false),Some(1));
+    assert_eq!('\u{AD}'.width(true),Some(1));
 
-    assert_eq!('\u1160'.width(false),Some(0));
-    assert_eq!('\u1160'.width(true),Some(0));
+    assert_eq!('\u{1160}'.width(false),Some(0));
+    assert_eq!('\u{1160}'.width(true),Some(0));
 
-    assert_eq!('\u00a1'.width(false),Some(1));
-    assert_eq!('\u00a1'.width(true),Some(2));
+    assert_eq!('\u{a1}'.width(false),Some(1));
+    assert_eq!('\u{a1}'.width(true),Some(2));
 
-    assert_eq!('\u0300'.width(false),Some(0));
-    assert_eq!('\u0300'.width(true),Some(0));
+    assert_eq!('\u{300}'.width(false),Some(0));
+    assert_eq!('\u{300}'.width(true),Some(0));
 }
diff --git a/src/libcoretest/iter.rs b/src/libcoretest/iter.rs
index b53791f6944..2aa2a229f90 100644
--- a/src/libcoretest/iter.rs
+++ b/src/libcoretest/iter.rs
@@ -103,7 +103,7 @@ fn test_iterator_chain() {
 
 #[test]
 fn test_filter_map() {
-    let mut it = count(0u, 1u).take(10)
+    let it = count(0u, 1u).take(10)
         .filter_map(|x| if x % 2 == 0 { Some(x*x) } else { None });
     assert!(it.collect::<Vec<uint>>() == vec![0*0, 2*2, 4*4, 6*6, 8*8]);
 }
diff --git a/src/libcoretest/nonzero.rs b/src/libcoretest/nonzero.rs
index ed66be3d890..ab2f6da1cf7 100644
--- a/src/libcoretest/nonzero.rs
+++ b/src/libcoretest/nonzero.rs
@@ -92,7 +92,7 @@ fn test_match_option_empty_string() {
 
 #[test]
 fn test_match_option_string() {
-    let five = "Five".into_string();
+    let five = "Five".to_string();
     match Some(five) {
         Some(s) => assert_eq!(s, "Five"),
         None => panic!("unexpected None while matching on Some(String { ... })")
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);
     }
 }
diff --git a/src/libcoretest/ptr.rs b/src/libcoretest/ptr.rs
index 162f75763de..875affe0ac7 100644
--- a/src/libcoretest/ptr.rs
+++ b/src/libcoretest/ptr.rs
@@ -10,6 +10,7 @@
 
 use core::ptr::*;
 use core::mem;
+use std::iter::repeat;
 
 #[test]
 fn test() {
@@ -56,19 +57,15 @@ fn test() {
 fn test_is_null() {
     let p: *const int = null();
     assert!(p.is_null());
-    assert!(!p.is_not_null());
 
     let q = unsafe { p.offset(1) };
     assert!(!q.is_null());
-    assert!(q.is_not_null());
 
     let mp: *mut int = null_mut();
     assert!(mp.is_null());
-    assert!(!mp.is_not_null());
 
     let mq = unsafe { mp.offset(1) };
     assert!(!mq.is_null());
-    assert!(mq.is_not_null());
 }
 
 #[test]
@@ -116,7 +113,7 @@ fn test_as_mut() {
 #[test]
 fn test_ptr_addition() {
     unsafe {
-        let xs = Vec::from_elem(16, 5i);
+        let xs = repeat(5i).take(16).collect::<Vec<_>>();
         let mut ptr = xs.as_ptr();
         let end = ptr.offset(16);
 
@@ -134,7 +131,7 @@ fn test_ptr_addition() {
             m_ptr = m_ptr.offset(1);
         }
 
-        assert!(xs_mut == Vec::from_elem(16, 10i));
+        assert!(xs_mut == repeat(10i).take(16).collect::<Vec<_>>());
     }
 }
 
diff --git a/src/libcoretest/str.rs b/src/libcoretest/str.rs
index fc02f46724f..1c0af55370d 100644
--- a/src/libcoretest/str.rs
+++ b/src/libcoretest/str.rs
@@ -8,13 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-use std::str::from_str;
-
 #[test]
 fn test_bool_from_str() {
-    assert_eq!(from_str::<bool>("true"), Some(true));
-    assert_eq!(from_str::<bool>("false"), Some(false));
-    assert_eq!(from_str::<bool>("not even a boolean"), None);
+    assert_eq!("true".parse(), Some(true));
+    assert_eq!("false".parse(), Some(false));
+    assert_eq!("not even a boolean".parse::<bool>(), None);
 }
 
 fn check_contains_all_substrings(s: &str) {
@@ -120,6 +118,6 @@ fn test_rev_split_char_iterator_no_trailing() {
 #[test]
 fn test_utf16_code_units() {
     use unicode::str::Utf16Encoder;
-    assert_eq!(Utf16Encoder::new(vec!['é', '\U0001F4A9'].into_iter()).collect::<Vec<u16>>(),
+    assert_eq!(Utf16Encoder::new(vec!['é', '\u{1F4A9}'].into_iter()).collect::<Vec<u16>>(),
                vec![0xE9, 0xD83D, 0xDCA9])
 }