diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-01-22 23:49:57 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-01-26 09:29:28 -0800 |
| commit | cb343c33acf0f9833d8d6eb637234acf4321976b (patch) | |
| tree | e8f94b5bd4fac82b36d1ea8efa37e8690e8229eb /src/libstd/sys/windows | |
| parent | 4b3c35509b7bd75c0b4712bb45440955d997ae75 (diff) | |
| download | rust-cb343c33acf0f9833d8d6eb637234acf4321976b.tar.gz rust-cb343c33acf0f9833d8d6eb637234acf4321976b.zip | |
Fix warnings during tests
The deny(warnings) attribute is now enabled for tests so we need to weed out these warnings as well.
Diffstat (limited to 'src/libstd/sys/windows')
| -rw-r--r-- | src/libstd/sys/windows/fs.rs | 4 | ||||
| -rw-r--r-- | src/libstd/sys/windows/mod.rs | 42 | ||||
| -rw-r--r-- | src/libstd/sys/windows/process.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys/windows/stack_overflow.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sys/windows/thread.rs | 1 |
5 files changed, 25 insertions, 25 deletions
diff --git a/src/libstd/sys/windows/fs.rs b/src/libstd/sys/windows/fs.rs index 60e3f7c22bd..a8b82ef5f29 100644 --- a/src/libstd/sys/windows/fs.rs +++ b/src/libstd/sys/windows/fs.rs @@ -639,7 +639,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result<u64> { fn directory_junctions_are_directories() { use ffi::OsStr; use env; - use rand::{self, StdRng, Rng}; + use rand::{self, Rng}; use vec::Vec; macro_rules! t { @@ -683,7 +683,7 @@ fn directory_junctions_are_directories() { let mut data = [0u8; c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; let mut db = data.as_mut_ptr() as *mut c::REPARSE_MOUNTPOINT_DATA_BUFFER; - let mut buf = &mut (*db).ReparseTarget as *mut _; + let buf = &mut (*db).ReparseTarget as *mut _; let mut i = 0; let v = br"\??\"; let v = v.iter().map(|x| *x as u16); diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs index 16c4ae8257c..9ecef5ee92c 100644 --- a/src/libstd/sys/windows/mod.rs +++ b/src/libstd/sys/windows/mod.rs @@ -8,9 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(missing_docs)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] +#![allow(missing_docs, bad_style)] use prelude::v1::*; @@ -20,7 +18,6 @@ use num::Zero; use os::windows::ffi::{OsStrExt, OsStringExt}; use path::PathBuf; use time::Duration; -use alloc::oom; #[macro_use] pub mod compat; @@ -43,25 +40,26 @@ pub mod thread_local; pub mod time; pub mod stdio; -// See comment in sys/unix/mod.rs -fn oom_handler() -> ! { - use intrinsics; - use ptr; - let msg = "fatal runtime error: out of memory\n"; - unsafe { - // WriteFile silently fails if it is passed an invalid handle, so there - // is no need to check the result of GetStdHandle. - c::WriteFile(c::GetStdHandle(c::STD_ERROR_HANDLE), - msg.as_ptr() as c::LPVOID, - msg.len() as c::DWORD, - ptr::null_mut(), - ptr::null_mut()); - intrinsics::abort(); - } -} - +#[cfg(not(test))] pub fn init() { - oom::set_oom_handler(oom_handler); + ::alloc::oom::set_oom_handler(oom_handler); + + // See comment in sys/unix/mod.rs + fn oom_handler() -> ! { + use intrinsics; + use ptr; + let msg = "fatal runtime error: out of memory\n"; + unsafe { + // WriteFile silently fails if it is passed an invalid handle, so + // there is no need to check the result of GetStdHandle. + c::WriteFile(c::GetStdHandle(c::STD_ERROR_HANDLE), + msg.as_ptr() as c::LPVOID, + msg.len() as c::DWORD, + ptr::null_mut(), + ptr::null_mut()); + intrinsics::abort(); + } + } } pub fn decode_error_kind(errno: i32) -> ErrorKind { diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index e0f8d6f9df9..4ab9f678d06 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -386,7 +386,6 @@ impl Stdio { #[cfg(test)] mod tests { use prelude::v1::*; - use str; use ffi::{OsStr, OsString}; use super::make_command_line; diff --git a/src/libstd/sys/windows/stack_overflow.rs b/src/libstd/sys/windows/stack_overflow.rs index 01317bec0de..4a406d70e63 100644 --- a/src/libstd/sys/windows/stack_overflow.rs +++ b/src/libstd/sys/windows/stack_overflow.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![cfg_attr(test, allow(dead_code))] + use sys_common::util::report_overflow; use sys::c; diff --git a/src/libstd/sys/windows/thread.rs b/src/libstd/sys/windows/thread.rs index 1ba85867563..b18772c0c24 100644 --- a/src/libstd/sys/windows/thread.rs +++ b/src/libstd/sys/windows/thread.rs @@ -83,6 +83,7 @@ impl Thread { pub fn into_handle(self) -> Handle { self.handle } } +#[cfg_attr(test, allow(dead_code))] pub mod guard { pub unsafe fn current() -> Option<usize> { None } pub unsafe fn init() -> Option<usize> { None } |
