about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNODA, Kai <nodakai@gmail.com>2014-10-05 18:11:17 +0800
committerNODA, Kai <nodakai@gmail.com>2014-10-13 14:16:22 +0800
commitf27ad3d3e99ce679f782607971a9f6f18befa503 (patch)
tree388f850cfb1e4d06077dfa6cd28a0e79eda28c07 /src/libstd
parenta6e0c76ef4b8ed87698dc9fe51e952039d33b913 (diff)
downloadrust-f27ad3d3e99ce679f782607971a9f6f18befa503.tar.gz
rust-f27ad3d3e99ce679f782607971a9f6f18befa503.zip
Clean up rustc warnings.
compiletest: compact "linux" "macos" etc.as "unix".
liballoc: remove a superfluous "use".
libcollections: remove invocations of deprecated methods in favor of
    their suggested replacements and use "_" for a loop counter.
libcoretest: remove invocations of deprecated methods;  also add
    "allow(deprecated)" for testing a deprecated method itself.
libglob: use "cfg_attr".
libgraphviz: add a test for one of data constructors.
libgreen: remove a superfluous "use".
libnum: "allow(type_overflow)" for type cast into u8 in a test code.
librustc: names of static variables should be in upper case.
libserialize: v[i] instead of get().
libstd/ascii: to_lowercase() instead of to_lower().
libstd/bitflags: modify AnotherSetOfFlags to use i8 as its backend.
    It will serve better for testing various aspects of bitflags!.
libstd/collections: "allow(deprecated)" for testing a deprecated
    method itself.
libstd/io: remove invocations of deprecated methods and superfluous "use".
    Also add #[test] where it was missing.
libstd/num: introduce a helper function to effectively remove
    invocations of a deprecated method.
libstd/path and rand: remove invocations of deprecated methods and
    superfluous "use".
libstd/task and libsync/comm: "allow(deprecated)" for testing
    a deprecated method itself.
libsync/deque: remove superfluous "unsafe".
libsync/mutex and once: names of static variables should be in upper case.
libterm: introduce a helper function to effectively remove
    invocations of a deprecated method.

We still see a few warnings about using obsoleted native::task::spawn()
in the test modules for libsync.  I'm not sure how I should replace them
with std::task::TaksBuilder and native::task::NativeTaskBuilder
(dependency to libstd?)

Signed-off-by: NODA, Kai <nodakai@gmail.com>
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ascii.rs18
-rw-r--r--src/libstd/bitflags.rs31
-rw-r--r--src/libstd/collections/hashmap/map.rs1
-rw-r--r--src/libstd/io/buffered.rs6
-rw-r--r--src/libstd/io/fs.rs10
-rw-r--r--src/libstd/io/mem.rs2
-rw-r--r--src/libstd/io/mod.rs42
-rw-r--r--src/libstd/io/net/addrinfo.rs2
-rw-r--r--src/libstd/io/net/tcp.rs2
-rw-r--r--src/libstd/io/pipe.rs1
-rw-r--r--src/libstd/io/process.rs8
-rw-r--r--src/libstd/io/stdio.rs5
-rw-r--r--src/libstd/io/timer.rs1
-rw-r--r--src/libstd/num/strconv.rs34
-rw-r--r--src/libstd/path/posix.rs4
-rw-r--r--src/libstd/rand/reader.rs15
-rw-r--r--src/libstd/task.rs1
17 files changed, 109 insertions, 74 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs
index 7a36680b3a6..71d38ac6659 100644
--- a/src/libstd/ascii.rs
+++ b/src/libstd/ascii.rs
@@ -582,15 +582,15 @@ mod tests {
         assert_eq!('A'.to_ascii().to_char(), 'A');
         assert_eq!('A'.to_ascii().to_byte(), 65u8);
 
-        assert_eq!('A'.to_ascii().to_lower().to_char(), 'a');
-        assert_eq!('Z'.to_ascii().to_lower().to_char(), 'z');
-        assert_eq!('a'.to_ascii().to_upper().to_char(), 'A');
-        assert_eq!('z'.to_ascii().to_upper().to_char(), 'Z');
-
-        assert_eq!('@'.to_ascii().to_lower().to_char(), '@');
-        assert_eq!('['.to_ascii().to_lower().to_char(), '[');
-        assert_eq!('`'.to_ascii().to_upper().to_char(), '`');
-        assert_eq!('{'.to_ascii().to_upper().to_char(), '{');
+        assert_eq!('A'.to_ascii().to_lowercase().to_char(), 'a');
+        assert_eq!('Z'.to_ascii().to_lowercase().to_char(), 'z');
+        assert_eq!('a'.to_ascii().to_uppercase().to_char(), 'A');
+        assert_eq!('z'.to_ascii().to_uppercase().to_char(), 'Z');
+
+        assert_eq!('@'.to_ascii().to_lowercase().to_char(), '@');
+        assert_eq!('['.to_ascii().to_lowercase().to_char(), '[');
+        assert_eq!('`'.to_ascii().to_uppercase().to_char(), '`');
+        assert_eq!('{'.to_ascii().to_uppercase().to_char(), '{');
 
         assert!('0'.to_ascii().is_digit());
         assert!('9'.to_ascii().is_digit());
diff --git a/src/libstd/bitflags.rs b/src/libstd/bitflags.rs
index adb55f2cc8c..42e3a823ff4 100644
--- a/src/libstd/bitflags.rs
+++ b/src/libstd/bitflags.rs
@@ -273,8 +273,8 @@ mod tests {
     }
 
     bitflags! {
-        flags AnotherSetOfFlags: uint {
-            const AnotherFlag = 1u,
+        flags AnotherSetOfFlags: i8 {
+            const AnotherFlag = -1_i8,
         }
     }
 
@@ -283,6 +283,9 @@ mod tests {
         assert_eq!(Flags::empty().bits(), 0x00000000);
         assert_eq!(FlagA.bits(), 0x00000001);
         assert_eq!(FlagABC.bits(), 0x00000111);
+
+        assert_eq!(AnotherSetOfFlags::empty().bits(), 0x00);
+        assert_eq!(AnotherFlag.bits(), !0_i8);
     }
 
     #[test]
@@ -292,6 +295,8 @@ mod tests {
         assert!(Flags::from_bits(0x10) == Some(FlagB));
         assert!(Flags::from_bits(0x11) == Some(FlagA | FlagB));
         assert!(Flags::from_bits(0x1000) == None);
+
+        assert!(AnotherSetOfFlags::from_bits(!0_i8) == Some(AnotherFlag));
     }
 
     #[test]
@@ -302,6 +307,8 @@ mod tests {
         assert!(Flags::from_bits_truncate(0x11) == (FlagA | FlagB));
         assert!(Flags::from_bits_truncate(0x1000) == Flags::empty());
         assert!(Flags::from_bits_truncate(0x1001) == FlagA);
+
+        assert!(AnotherSetOfFlags::from_bits_truncate(0_i8) == AnotherSetOfFlags::empty());
     }
 
     #[test]
@@ -309,6 +316,8 @@ mod tests {
         assert!(Flags::empty().is_empty());
         assert!(!FlagA.is_empty());
         assert!(!FlagABC.is_empty());
+
+        assert!(!AnotherFlag.is_empty());
     }
 
     #[test]
@@ -316,6 +325,8 @@ mod tests {
         assert!(Flags::all().is_all());
         assert!(!FlagA.is_all());
         assert!(FlagABC.is_all());
+
+        assert!(AnotherFlag.is_all());
     }
 
     #[test]
@@ -323,6 +334,8 @@ mod tests {
         let e1 = Flags::empty();
         let e2 = Flags::empty();
         assert!(!e1.intersects(e2));
+
+        assert!(AnotherFlag.intersects(AnotherFlag));
     }
 
     #[test]
@@ -353,6 +366,8 @@ mod tests {
         assert!(!e1.contains(e2));
         assert!(e2.contains(e1));
         assert!(FlagABC.contains(e2));
+
+        assert!(AnotherFlag.contains(AnotherFlag));
     }
 
     #[test]
@@ -361,6 +376,10 @@ mod tests {
         let e2 = FlagA | FlagB;
         e1.insert(e2);
         assert!(e1 == e2);
+
+        let mut e3 = AnotherSetOfFlags::empty();
+        e3.insert(AnotherFlag);
+        assert!(e3 == AnotherFlag);
     }
 
     #[test]
@@ -369,6 +388,10 @@ mod tests {
         let e2 = FlagA | FlagC;
         e1.remove(e2);
         assert!(e1 == FlagB);
+
+        let mut e3 = AnotherFlag;
+        e3.remove(AnotherFlag);
+        assert!(e3 == AnotherSetOfFlags::empty());
     }
 
     #[test]
@@ -383,6 +406,10 @@ mod tests {
         let mut e3 = e1;
         e3.toggle(e2);
         assert!(e3 == FlagA | FlagB);
+
+        let mut m4 = AnotherSetOfFlags::empty();
+        m4.toggle(AnotherSetOfFlags::empty());
+        assert!(m4 == AnotherSetOfFlags::empty());
     }
 
     #[test]
diff --git a/src/libstd/collections/hashmap/map.rs b/src/libstd/collections/hashmap/map.rs
index ef40402105b..bdd9d8d9d1f 100644
--- a/src/libstd/collections/hashmap/map.rs
+++ b/src/libstd/collections/hashmap/map.rs
@@ -1930,6 +1930,7 @@ mod test_map {
     }
 
     #[test]
+    #[allow(deprecated)] // insert_or_update_with
     fn test_update_with() {
         let mut m = HashMap::with_capacity(4);
         assert!(m.insert(1i, 2i));
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 754b440b0de..8ab0d3a5504 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -400,7 +400,7 @@ mod test {
 
     impl Reader for ShortReader {
         fn read(&mut self, _: &mut [u8]) -> io::IoResult<uint> {
-            match self.lengths.shift() {
+            match self.lengths.remove(0) {
                 Some(i) => Ok(i),
                 None => Err(io::standard_error(io::EndOfFile))
             }
@@ -551,7 +551,7 @@ mod test {
 
     #[test]
     fn test_read_line() {
-        let in_buf = MemReader::new(Vec::from_slice(b"a\nb\nc"));
+        let in_buf = MemReader::new(b"a\nb\nc".to_vec());
         let mut reader = BufferedReader::with_capacity(2, in_buf);
         assert_eq!(reader.read_line(), Ok("a\n".to_string()));
         assert_eq!(reader.read_line(), Ok("b\n".to_string()));
@@ -561,7 +561,7 @@ mod test {
 
     #[test]
     fn test_lines() {
-        let in_buf = MemReader::new(Vec::from_slice(b"a\nb\nc"));
+        let in_buf = MemReader::new(b"a\nb\nc".to_vec());
         let mut reader = BufferedReader::with_capacity(2, in_buf);
         let mut it = reader.lines();
         assert_eq!(it.next(), Some(Ok("a\n".to_string())));
diff --git a/src/libstd/io/fs.rs b/src/libstd/io/fs.rs
index 82494d41aa3..e8fed67fffe 100644
--- a/src/libstd/io/fs.rs
+++ b/src/libstd/io/fs.rs
@@ -1415,7 +1415,7 @@ mod test {
         check!(copy(&input, &output));
 
         assert_eq!(check!(File::open(&output).read_to_end()),
-                   (Vec::from_slice(b"foo")));
+                   b"foo".to_vec());
     }
 
     #[test]
@@ -1459,7 +1459,7 @@ mod test {
         }
         assert_eq!(check!(stat(&out)).size, check!(stat(&input)).size);
         assert_eq!(check!(File::open(&out).read_to_end()),
-                   (Vec::from_slice(b"foobar")));
+                   b"foobar".to_vec());
     }
 
     #[cfg(not(windows))] // apparently windows doesn't like symlinks
@@ -1497,7 +1497,7 @@ mod test {
         assert_eq!(check!(stat(&out)).size, check!(stat(&input)).size);
         assert_eq!(check!(stat(&out)).size, check!(input.stat()).size);
         assert_eq!(check!(File::open(&out).read_to_end()),
-                   (Vec::from_slice(b"foobar")));
+                   b"foobar".to_vec());
 
         // can't link to yourself
         match link(&input, &input) {
@@ -1560,7 +1560,7 @@ mod test {
         check!(file.fsync());
         assert_eq!(check!(file.stat()).size, 10);
         assert_eq!(check!(File::open(&path).read_to_end()),
-                   (Vec::from_slice(b"foobar\0\0\0\0")));
+                   b"foobar\0\0\0\0".to_vec());
 
         // Truncate to a smaller length, don't seek, and then write something.
         // Ensure that the intermediate zeroes are all filled in (we're seeked
@@ -1571,7 +1571,7 @@ mod test {
         check!(file.fsync());
         assert_eq!(check!(file.stat()).size, 9);
         assert_eq!(check!(File::open(&path).read_to_end()),
-                   (Vec::from_slice(b"fo\0\0\0\0wut")));
+                   b"fo\0\0\0\0wut".to_vec());
         drop(file);
     }
 
diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs
index 0f8e0ed52f8..f86ae05d623 100644
--- a/src/libstd/io/mem.rs
+++ b/src/libstd/io/mem.rs
@@ -617,7 +617,7 @@ mod test {
     #[bench]
     fn bench_mem_reader(b: &mut Bencher) {
         b.iter(|| {
-            let buf = Vec::from_slice([5 as u8, ..100]);
+            let buf = [5 as u8, ..100].to_vec();
             {
                 let mut rdr = MemReader::new(buf);
                 for _i in range(0u, 10) {
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index d18b3cdf2e7..8592d48974a 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -1949,62 +1949,62 @@ mod tests {
                         return Ok(0);
                     }
                 };
-                behavior.shift();
+                behavior.remove(0);
             }
         }
     }
 
     #[test]
     fn test_read_at_least() {
-        let mut r = BadReader::new(MemReader::new(Vec::from_slice(b"hello, world!")),
-                                   Vec::from_slice([GoodBehavior(uint::MAX)]));
+        let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
+                                   vec![GoodBehavior(uint::MAX)]);
         let mut buf = [0u8, ..5];
         assert!(r.read_at_least(1, buf).unwrap() >= 1);
         assert!(r.read_exact(5).unwrap().len() == 5); // read_exact uses read_at_least
         assert!(r.read_at_least(0, buf).is_ok());
 
-        let mut r = BadReader::new(MemReader::new(Vec::from_slice(b"hello, world!")),
-                                   Vec::from_slice([BadBehavior(50), GoodBehavior(uint::MAX)]));
+        let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
+                                   vec![BadBehavior(50), GoodBehavior(uint::MAX)]);
         assert!(r.read_at_least(1, buf).unwrap() >= 1);
 
-        let mut r = BadReader::new(MemReader::new(Vec::from_slice(b"hello, world!")),
-                                   Vec::from_slice([BadBehavior(1), GoodBehavior(1),
-                                                    BadBehavior(50), GoodBehavior(uint::MAX)]));
+        let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
+                                   vec![BadBehavior(1), GoodBehavior(1),
+                                        BadBehavior(50), GoodBehavior(uint::MAX)]);
         assert!(r.read_at_least(1, buf).unwrap() >= 1);
         assert!(r.read_at_least(1, buf).unwrap() >= 1);
 
-        let mut r = BadReader::new(MemReader::new(Vec::from_slice(b"hello, world!")),
-                                   Vec::from_slice([BadBehavior(uint::MAX)]));
+        let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
+                                   vec![BadBehavior(uint::MAX)]);
         assert_eq!(r.read_at_least(1, buf).unwrap_err().kind, NoProgress);
 
-        let mut r = MemReader::new(Vec::from_slice(b"hello, world!"));
+        let mut r = MemReader::new(b"hello, world!".to_vec());
         assert_eq!(r.read_at_least(5, buf).unwrap(), 5);
         assert_eq!(r.read_at_least(6, buf).unwrap_err().kind, InvalidInput);
     }
 
     #[test]
     fn test_push_at_least() {
-        let mut r = BadReader::new(MemReader::new(Vec::from_slice(b"hello, world!")),
-                                   Vec::from_slice([GoodBehavior(uint::MAX)]));
+        let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
+                                   vec![GoodBehavior(uint::MAX)]);
         let mut buf = Vec::new();
         assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
         assert!(r.push_at_least(0, 5, &mut buf).is_ok());
 
-        let mut r = BadReader::new(MemReader::new(Vec::from_slice(b"hello, world!")),
-                                   Vec::from_slice([BadBehavior(50), GoodBehavior(uint::MAX)]));
+        let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
+                                   vec![BadBehavior(50), GoodBehavior(uint::MAX)]);
         assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
 
-        let mut r = BadReader::new(MemReader::new(Vec::from_slice(b"hello, world!")),
-                                   Vec::from_slice([BadBehavior(1), GoodBehavior(1),
-                                                    BadBehavior(50), GoodBehavior(uint::MAX)]));
+        let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
+                                   vec![BadBehavior(1), GoodBehavior(1),
+                                        BadBehavior(50), GoodBehavior(uint::MAX)]);
         assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
         assert!(r.push_at_least(1, 5, &mut buf).unwrap() >= 1);
 
-        let mut r = BadReader::new(MemReader::new(Vec::from_slice(b"hello, world!")),
-                                   Vec::from_slice([BadBehavior(uint::MAX)]));
+        let mut r = BadReader::new(MemReader::new(b"hello, world!".to_vec()),
+                                   vec![BadBehavior(uint::MAX)]);
         assert_eq!(r.push_at_least(1, 5, &mut buf).unwrap_err().kind, NoProgress);
 
-        let mut r = MemReader::new(Vec::from_slice(b"hello, world!"));
+        let mut r = MemReader::new(b"hello, world!".to_vec());
         assert_eq!(r.push_at_least(5, 1, &mut buf).unwrap_err().kind, InvalidInput);
     }
 
diff --git a/src/libstd/io/net/addrinfo.rs b/src/libstd/io/net/addrinfo.rs
index 27241f9bfa5..9d85701eb29 100644
--- a/src/libstd/io/net/addrinfo.rs
+++ b/src/libstd/io/net/addrinfo.rs
@@ -126,9 +126,7 @@ fn lookup(hostname: Option<&str>, servname: Option<&str>, hint: Option<Hint>)
 #[cfg(all(test, not(target_os = "android")))]
 mod test {
     use super::*;
-    use io::net::tcp::*;
     use io::net::ip::*;
-    use io::net::udp::*;
 
     #[test]
     fn dns_smoke_test() {
diff --git a/src/libstd/io/net/tcp.rs b/src/libstd/io/net/tcp.rs
index e2a850c58e4..d6528ce977e 100644
--- a/src/libstd/io/net/tcp.rs
+++ b/src/libstd/io/net/tcp.rs
@@ -521,10 +521,8 @@ impl Clone for TcpAcceptor {
 #[cfg(test)]
 #[allow(experimental)]
 mod test {
-    use super::*;
     use io::net::tcp::*;
     use io::net::ip::*;
-    use io::net::udp::*;
     use io::*;
     use io::test::*;
     use prelude::*;
diff --git a/src/libstd/io/pipe.rs b/src/libstd/io/pipe.rs
index d7d478bd458..9362a48a6f0 100644
--- a/src/libstd/io/pipe.rs
+++ b/src/libstd/io/pipe.rs
@@ -118,7 +118,6 @@ impl Writer for PipeStream {
 
 #[cfg(test)]
 mod test {
-    use super::*;
     use prelude::*;
 
     #[test]
diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs
index 5de4bc10e1a..88f8434b957 100644
--- a/src/libstd/io/process.rs
+++ b/src/libstd/io/process.rs
@@ -727,7 +727,7 @@ mod tests {
         assert!(p.is_ok());
         let mut p = p.unwrap();
         assert!(p.stdout.is_some());
-        let ret = read_all(p.stdout.get_mut_ref() as &mut Reader);
+        let ret = read_all(p.stdout.as_mut().unwrap() as &mut Reader);
         assert!(p.wait().unwrap().success());
         return ret;
     }
@@ -758,9 +758,9 @@ mod tests {
                             .stdin(CreatePipe(true, false))
                             .stdout(CreatePipe(false, true))
                             .spawn().unwrap();
-        p.stdin.get_mut_ref().write("foobar".as_bytes()).unwrap();
+        p.stdin.as_mut().unwrap().write("foobar".as_bytes()).unwrap();
         drop(p.stdin.take());
-        let out = read_all(p.stdout.get_mut_ref() as &mut Reader);
+        let out = read_all(p.stdout.as_mut().unwrap() as &mut Reader);
         assert!(p.wait().unwrap().success());
         assert_eq!(out, "foobar\n".to_string());
     }
@@ -1019,7 +1019,7 @@ mod tests {
     fn test_add_to_env() {
         let prog = env_cmd().env("RUN_TEST_NEW_ENV", "123").spawn().unwrap();
         let result = prog.wait_with_output().unwrap();
-        let output = str::from_utf8_lossy(result.output.as_slice()).into_string();
+        let output = String::from_utf8_lossy(result.output.as_slice()).into_string();
 
         assert!(output.as_slice().contains("RUN_TEST_NEW_ENV=123"),
                 "didn't find RUN_TEST_NEW_ENV inside of:\n\n{}", output);
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index b174f19f198..93037f765d6 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -385,6 +385,7 @@ mod tests {
     use super::*;
     use prelude::*;
 
+    #[test]
     fn smoke() {
         // Just make sure we can acquire handles
         stdin();
@@ -392,6 +393,7 @@ mod tests {
         stderr();
     }
 
+    #[test]
     fn capture_stdout() {
         use io::{ChanReader, ChanWriter};
 
@@ -404,9 +406,10 @@ mod tests {
         assert_eq!(r.read_to_string().unwrap(), "hello!\n".to_string());
     }
 
+    #[test]
     fn capture_stderr() {
         use realstd::comm::channel;
-        use realstd::io::{Writer, ChanReader, ChanWriter, Reader};
+        use realstd::io::{ChanReader, ChanWriter, Reader};
 
         let (tx, rx) = channel();
         let (mut r, w) = (ChanReader::new(rx), ChanWriter::new(tx));
diff --git a/src/libstd/io/timer.rs b/src/libstd/io/timer.rs
index e7df0285540..a657989fe12 100644
--- a/src/libstd/io/timer.rs
+++ b/src/libstd/io/timer.rs
@@ -235,7 +235,6 @@ mod test {
     use super::*;
     use time::Duration;
     use task::spawn;
-    use io::*;
     use prelude::*;
 
     #[test]
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index f97bbe0dc8e..48ee7664c16 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -819,72 +819,82 @@ mod bench {
     mod uint {
         use super::test::Bencher;
         use rand::{weak_rng, Rng};
-        use num::ToStrRadix;
+        use std::fmt;
+
+        #[inline]
+        fn to_string(x: uint, base: u8) {
+            format!("{}", fmt::radix(x, base));
+        }
 
         #[bench]
         fn to_str_bin(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<uint>().to_str_radix(2); })
+            b.iter(|| { to_string(rng.gen::<uint>(), 2); })
         }
 
         #[bench]
         fn to_str_oct(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<uint>().to_str_radix(8); })
+            b.iter(|| { to_string(rng.gen::<uint>(), 8); })
         }
 
         #[bench]
         fn to_str_dec(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<uint>().to_str_radix(10); })
+            b.iter(|| { to_string(rng.gen::<uint>(), 10); })
         }
 
         #[bench]
         fn to_str_hex(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<uint>().to_str_radix(16); })
+            b.iter(|| { to_string(rng.gen::<uint>(), 16); })
         }
 
         #[bench]
         fn to_str_base_36(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<uint>().to_str_radix(36); })
+            b.iter(|| { to_string(rng.gen::<uint>(), 36); })
         }
     }
 
     mod int {
         use super::test::Bencher;
         use rand::{weak_rng, Rng};
-        use num::ToStrRadix;
+        use std::fmt;
+
+        #[inline]
+        fn to_string(x: int, base: u8) {
+            format!("{}", fmt::radix(x, base));
+        }
 
         #[bench]
         fn to_str_bin(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<int>().to_str_radix(2); })
+            b.iter(|| { to_string(rng.gen::<int>(), 2); })
         }
 
         #[bench]
         fn to_str_oct(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<int>().to_str_radix(8); })
+            b.iter(|| { to_string(rng.gen::<int>(), 8); })
         }
 
         #[bench]
         fn to_str_dec(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<int>().to_str_radix(10); })
+            b.iter(|| { to_string(rng.gen::<int>(), 10); })
         }
 
         #[bench]
         fn to_str_hex(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<int>().to_str_radix(16); })
+            b.iter(|| { to_string(rng.gen::<int>(), 16); })
         }
 
         #[bench]
         fn to_str_base_36(b: &mut Bencher) {
             let mut rng = weak_rng();
-            b.iter(|| { rng.gen::<int>().to_str_radix(36); })
+            b.iter(|| { to_string(rng.gen::<int>(), 36); })
         }
     }
 
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index f7fb9adb1fb..27eafdab642 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -775,7 +775,7 @@ mod tests {
         t!(s: "a/b/c", ["d".to_string(), "e".to_string()], "a/b/c/d/e");
         t!(v: b"a/b/c", [b"d", b"e"], b"a/b/c/d/e");
         t!(v: b"a/b/c", [b"d", b"/e", b"f"], b"/e/f");
-        t!(v: b"a/b/c", [Vec::from_slice(b"d"), Vec::from_slice(b"e")], b"a/b/c/d/e");
+        t!(v: b"a/b/c", [b"d".to_vec(), b"e".to_vec()], b"a/b/c/d/e");
     }
 
     #[test]
@@ -879,7 +879,7 @@ mod tests {
         t!(s: "a/b/c", ["d", "/e", "f"], "/e/f");
         t!(s: "a/b/c", ["d".to_string(), "e".to_string()], "a/b/c/d/e");
         t!(v: b"a/b/c", [b"d", b"e"], b"a/b/c/d/e");
-        t!(v: b"a/b/c", [Vec::from_slice(b"d"), Vec::from_slice(b"e")], b"a/b/c/d/e");
+        t!(v: b"a/b/c", [b"d".to_vec(), b"e".to_vec()], b"a/b/c/d/e");
     }
 
     #[test]
diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs
index fe5d8fc068c..8ca1cec3e0a 100644
--- a/src/libstd/rand/reader.rs
+++ b/src/libstd/rand/reader.rs
@@ -76,7 +76,6 @@ mod test {
 
     use super::ReaderRng;
     use io::MemReader;
-    use mem;
     use rand::Rng;
 
     #[test]
@@ -87,25 +86,25 @@ mod test {
                      0,   0, 0, 0, 0, 0, 0, 3];
         let mut rng = ReaderRng::new(MemReader::new(v));
 
-        assert_eq!(rng.next_u64(), mem::to_be64(1));
-        assert_eq!(rng.next_u64(), mem::to_be64(2));
-        assert_eq!(rng.next_u64(), mem::to_be64(3));
+        assert_eq!(rng.next_u64(), 1_u64.to_be());
+        assert_eq!(rng.next_u64(), 2_u64.to_be());
+        assert_eq!(rng.next_u64(), 3_u64.to_be());
     }
     #[test]
     fn test_reader_rng_u32() {
         let v = vec![0u8, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3];
         let mut rng = ReaderRng::new(MemReader::new(v));
 
-        assert_eq!(rng.next_u32(), mem::to_be32(1));
-        assert_eq!(rng.next_u32(), mem::to_be32(2));
-        assert_eq!(rng.next_u32(), mem::to_be32(3));
+        assert_eq!(rng.next_u32(), 1_u32.to_be());
+        assert_eq!(rng.next_u32(), 2_u32.to_be());
+        assert_eq!(rng.next_u32(), 3_u32.to_be());
     }
     #[test]
     fn test_reader_rng_fill_bytes() {
         let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
         let mut w = [0u8, .. 8];
 
-        let mut rng = ReaderRng::new(MemReader::new(Vec::from_slice(v)));
+        let mut rng = ReaderRng::new(MemReader::new(v.as_slice().to_vec()));
         rng.fill_bytes(w);
 
         assert!(v == w);
diff --git a/src/libstd/task.rs b/src/libstd/task.rs
index 977b3018fa7..04d3bb8b3a7 100644
--- a/src/libstd/task.rs
+++ b/src/libstd/task.rs
@@ -447,6 +447,7 @@ mod test {
     }
 
     #[test]
+    #[allow(deprecated)]
     fn test_with_wrapper() {
         let (tx, rx) = channel();
         TaskBuilder::new().with_wrapper(proc(body) {