diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 82bd13475c7..0cdc71b6f60 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -73,7 +73,6 @@ #![feature(unboxed_closures)] #![feature(unsafe_no_drop_flag)] #![feature(core)] -#![feature(unique)] #![cfg_attr(test, feature(test, alloc, rustc_private))] #![cfg_attr(all(not(feature = "external_funcs"), not(feature = "external_crate")), feature(libc))] diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index a2924f8fe53..a9d6405a21b 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -2170,8 +2170,8 @@ mod tests { fn test_connect() { let v: [Vec; 0] = []; assert_eq!(v.connect(&0), []); - assert_eq!([vec![1i], vec![2, 3]].connect(&0), [1, 0, 2, 3]); - assert_eq!([vec![1i], vec![2], vec![3]].connect(&0), [1, 0, 2, 0, 3]); + assert_eq!([vec![1], vec![2, 3]].connect(&0), [1, 0, 2, 3]); + assert_eq!([vec![1], vec![2], vec![3]].connect(&0), [1, 0, 2, 0, 3]); let v: [&[_]; 2] = [&[1], &[2, 3]]; assert_eq!(v.connect(&0), [1, 0, 2, 3]); diff --git a/src/libcoretest/hash/mod.rs b/src/libcoretest/hash/mod.rs index 9b6af182f72..14cd8ae45a6 100644 --- a/src/libcoretest/hash/mod.rs +++ b/src/libcoretest/hash/mod.rs @@ -85,7 +85,7 @@ struct CustomHasher { output: u64 } impl Hasher for CustomHasher { fn finish(&self) -> u64 { self.output } - fn write(&mut self, data: &[u8]) { panic!() } + fn write(&mut self, _: &[u8]) { panic!() } fn write_u64(&mut self, data: u64) { self.output = data; } } diff --git a/src/libcoretest/str.rs b/src/libcoretest/str.rs index 019f935911f..a89d3380707 100644 --- a/src/libcoretest/str.rs +++ b/src/libcoretest/str.rs @@ -188,15 +188,13 @@ fn trim_ws() { mod pattern { use std::str::Pattern; - use std::str::{Searcher, ReverseSearcher, DoubleEndedSearcher}; + use std::str::{Searcher, ReverseSearcher}; use std::str::SearchStep::{self, Match, Reject, Done}; macro_rules! make_test { ($name:ident, $p:expr, $h:expr, [$($e:expr,)*]) => { mod $name { - use std::str::Pattern; - use std::str::{Searcher, ReverseSearcher, DoubleEndedSearcher}; - use std::str::SearchStep::{self, Match, Reject, Done}; + use std::str::SearchStep::{Match, Reject}; use super::{cmp_search_to_vec}; #[test] fn fwd() { diff --git a/src/librand/rand_impls.rs b/src/librand/rand_impls.rs index d5c5d500465..dbba7bceeda 100644 --- a/src/librand/rand_impls.rs +++ b/src/librand/rand_impls.rs @@ -214,7 +214,6 @@ impl Rand for Option { #[cfg(test)] mod tests { - use std::prelude::v1::*; use std::rand::{Rng, thread_rng, Open01, Closed01}; struct ConstantRng(u64); diff --git a/src/librbml/io.rs b/src/librbml/io.rs index c52465a8899..6d2da3d6c01 100644 --- a/src/librbml/io.rs +++ b/src/librbml/io.rs @@ -140,32 +140,32 @@ mod tests { fn test_seekable_mem_writer() { let mut writer = SeekableMemWriter::new(); assert_eq!(writer.tell(), Ok(0)); - writer.write(&[0]).unwrap(); + writer.write_all(&[0]).unwrap(); assert_eq!(writer.tell(), Ok(1)); - writer.write(&[1, 2, 3]).unwrap(); - writer.write(&[4, 5, 6, 7]).unwrap(); + writer.write_all(&[1, 2, 3]).unwrap(); + writer.write_all(&[4, 5, 6, 7]).unwrap(); assert_eq!(writer.tell(), Ok(8)); let b: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7]; assert_eq!(writer.get_ref(), b); writer.seek(0, old_io::SeekSet).unwrap(); assert_eq!(writer.tell(), Ok(0)); - writer.write(&[3, 4]).unwrap(); + writer.write_all(&[3, 4]).unwrap(); let b: &[_] = &[3, 4, 2, 3, 4, 5, 6, 7]; assert_eq!(writer.get_ref(), b); writer.seek(1, old_io::SeekCur).unwrap(); - writer.write(&[0, 1]).unwrap(); + writer.write_all(&[0, 1]).unwrap(); let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 7]; assert_eq!(writer.get_ref(), b); writer.seek(-1, old_io::SeekEnd).unwrap(); - writer.write(&[1, 2]).unwrap(); + writer.write_all(&[1, 2]).unwrap(); let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2]; assert_eq!(writer.get_ref(), b); writer.seek(1, old_io::SeekEnd).unwrap(); - writer.write(&[1]).unwrap(); + writer.write_all(&[1]).unwrap(); let b: &[_] = &[3, 4, 2, 0, 1, 5, 6, 1, 2, 0, 1]; assert_eq!(writer.get_ref(), b); } @@ -174,7 +174,7 @@ mod tests { fn seek_past_end() { let mut r = SeekableMemWriter::new(); r.seek(10, old_io::SeekSet).unwrap(); - assert!(r.write(&[3]).is_ok()); + assert!(r.write_all(&[3]).is_ok()); } #[test] @@ -190,7 +190,7 @@ mod tests { b.iter(|| { let mut wr = SeekableMemWriter::new(); for _ in 0..times { - wr.write(&src).unwrap(); + wr.write_all(&src).unwrap(); } let v = wr.unwrap(); diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 69bcc82f682..c94edb9d2a1 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -422,15 +422,14 @@ mod tests { use prelude::v1::*; use super::*; use libc; - use mem; #[test] fn c_to_rust() { let data = b"123\0"; let ptr = data.as_ptr() as *const libc::c_char; unsafe { - assert_eq!(c_str_to_bytes(&ptr), b"123"); - assert_eq!(c_str_to_bytes_with_nul(&ptr), b"123\0"); + assert_eq!(CStr::from_ptr(ptr).to_bytes(), b"123"); + assert_eq!(CStr::from_ptr(ptr).to_bytes_with_nul(), b"123\0"); } } diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index 3b4e15953c4..cf4eb09c19b 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -970,7 +970,7 @@ mod tests { struct R; impl Read for R { - fn read(&mut self, buf: &mut [u8]) -> io::Result { + fn read(&mut self, _: &mut [u8]) -> io::Result { Err(io::Error::new(io::ErrorKind::Other, "", None)) } } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index b5bdeb7f181..de02b6af642 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -124,7 +124,7 @@ #![feature(macro_reexport)] #![feature(hash)] #![feature(unique)] -#![cfg_attr(test, feature(test, rustc_private, env))] +#![cfg_attr(test, feature(test, rustc_private))] // Don't link to std. We are std. #![feature(no_std)] diff --git a/src/libstd/process.rs b/src/libstd/process.rs index c24b08deec2..3ed7daf4a0a 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -761,14 +761,13 @@ mod tests { #[cfg(not(target_os="android"))] #[test] fn test_inherit_env() { - use os; + use std::env; if running_on_valgrind() { return; } let result = env_cmd().output().unwrap(); let output = String::from_utf8(result.stdout).unwrap(); - let r = os::env(); - for &(ref k, ref v) in &r { + for (ref k, ref v) in env::vars() { // don't check windows magical empty-named variables assert!(k.is_empty() || output.contains(format!("{}={}", *k, *v).as_slice()), diff --git a/src/libterm/terminfo/searcher.rs b/src/libterm/terminfo/searcher.rs index a0cd7842070..15f7f3884ec 100644 --- a/src/libterm/terminfo/searcher.rs +++ b/src/libterm/terminfo/searcher.rs @@ -96,7 +96,7 @@ pub fn open(term: &str) -> Result { fn test_get_dbpath_for_term() { // woefully inadequate test coverage // note: current tests won't work with non-standard terminfo hierarchies (e.g. OS X's) - use std::os::{setenv, unsetenv}; + use std::env; // FIXME (#9639): This needs to handle non-utf8 paths fn x(t: &str) -> String { let p = get_dbpath_for_term(t).expect("no terminfo entry found"); @@ -104,9 +104,9 @@ fn test_get_dbpath_for_term() { }; assert!(x("screen") == "/usr/share/terminfo/s/screen"); assert!(get_dbpath_for_term("") == None); - setenv("TERMINFO_DIRS", ":"); + env::set_var("TERMINFO_DIRS", ":"); assert!(x("screen") == "/usr/share/terminfo/s/screen"); - unsetenv("TERMINFO_DIRS"); + env::remove_var("TERMINFO_DIRS"); } #[test] diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index a144904903e..3fbb07d03a8 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -732,8 +732,8 @@ fn should_sort_failures_before_printing_them() { Pretty(_) => unreachable!() }; - let apos = s.find_str("a").unwrap(); - let bpos = s.find_str("b").unwrap(); + let apos = s.find("a").unwrap(); + let bpos = s.find("b").unwrap(); assert!(apos < bpos); }