From 55ce45e7b52a0a360cf88cba71f59f7d3e9b2346 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sat, 28 Feb 2015 20:07:05 +0200 Subject: remove some compiler warnings --- src/libstd/ffi/c_str.rs | 5 ++--- src/libstd/io/mod.rs | 2 +- src/libstd/lib.rs | 2 +- src/libstd/process.rs | 5 ++--- 4 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/libstd') 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()), -- cgit 1.4.1-3-g733a5