From 9b99ebc36443cdc2e4ffca062e55b48c51d98c91 Mon Sep 17 00:00:00 2001 From: Bryant Mairs Date: Sun, 14 Jan 2018 16:32:34 -0800 Subject: [PATCH] Fail to compile for any unused code --- src/lib.rs | 3 +-- src/sys/aio.rs | 10 +++++----- src/sys/mman.rs | 6 +++++- src/sys/quota.rs | 3 --- src/sys/wait.rs | 4 +++- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 28d67f6f2d..e5972b4423 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,9 +10,8 @@ #![allow(dead_code)] #![cfg_attr(test, deny(warnings))] #![recursion_limit = "500"] -#![deny(unused_qualifications)] +#![deny(unused)] #![deny(unstable_features)] -#![deny(unused_import_braces)] #![deny(missing_copy_implementations)] #![deny(missing_debug_implementations)] diff --git a/src/sys/aio.rs b/src/sys/aio.rs index d85ecfa11f..349ff31901 100644 --- a/src/sys/aio.rs +++ b/src/sys/aio.rs @@ -86,7 +86,7 @@ pub struct AioCb<'a> { /// Could this `AioCb` potentially have any in-kernel state? in_progress: bool, /// Used to keep buffers from Drop'ing - keeper: Keeper<'a> + _keeper: Keeper<'a> } impl<'a> AioCb<'a> { @@ -115,7 +115,7 @@ impl<'a> AioCb<'a> { aiocb: a, mutable: false, in_progress: false, - keeper: Keeper::none + _keeper: Keeper::none } } @@ -143,7 +143,7 @@ impl<'a> AioCb<'a> { aiocb: a, mutable: true, in_progress: false, - keeper: Keeper::phantom(PhantomData) + _keeper: Keeper::phantom(PhantomData) } } @@ -174,7 +174,7 @@ impl<'a> AioCb<'a> { aiocb: a, mutable: true, in_progress: false, - keeper: Keeper::boxed(buf) + _keeper: Keeper::boxed(buf) } } @@ -208,7 +208,7 @@ impl<'a> AioCb<'a> { aiocb: a, mutable: false, in_progress: false, - keeper: Keeper::none + _keeper: Keeper::none } } diff --git a/src/sys/mman.rs b/src/sys/mman.rs index 5b4bd4f57d..9d1f88df89 100644 --- a/src/sys/mman.rs +++ b/src/sys/mman.rs @@ -1,7 +1,11 @@ -use {Error, Result, NixPath}; +use {Error, Result}; +#[cfg(not(target_os = "android"))] +use NixPath; use errno::Errno; +#[cfg(not(target_os = "android"))] use fcntl::OFlag; use libc::{self, c_int, c_void, size_t, off_t}; +#[cfg(not(target_os = "android"))] use sys::stat::Mode; use std::os::unix::io::RawFd; diff --git a/src/sys/quota.rs b/src/sys/quota.rs index 6d8e6267b0..b4cac1dc9b 100644 --- a/src/sys/quota.rs +++ b/src/sys/quota.rs @@ -33,9 +33,6 @@ libc_enum!{ Q_SYNC, Q_QUOTAON, Q_QUOTAOFF, - Q_GETFMT, - Q_GETINFO, - Q_SETINFO, Q_GETQUOTA, Q_SETQUOTA, } diff --git a/src/sys/wait.rs b/src/sys/wait.rs index 53c6a5f2e2..038354b107 100644 --- a/src/sys/wait.rs +++ b/src/sys/wait.rs @@ -141,6 +141,7 @@ fn stop_signal(status: i32) -> Result { Signal::from_c_int(unsafe { libc::WSTOPSIG(status) }) } +#[cfg(any(target_os = "android", target_os = "linux"))] fn syscall_stop(status: i32) -> bool { // From ptrace(2), setting PTRACE_O_TRACESYSGOOD has the effect // of delivering SIGTRAP | 0x80 as the signal number for syscall @@ -149,6 +150,7 @@ fn syscall_stop(status: i32) -> bool { unsafe { libc::WSTOPSIG(status) == libc::SIGTRAP | 0x80 } } +#[cfg(any(target_os = "android", target_os = "linux"))] fn stop_additional(status: i32) -> c_int { (status >> 16) as c_int } @@ -182,7 +184,7 @@ impl WaitStatus { WaitStatus::Signaled(pid, try!(term_signal(status)), dumped_core(status)) } else if stopped(status) { cfg_if! { - if #[cfg(any(target_os = "linux", target_os = "android"))] { + if #[cfg(any(target_os = "android", target_os = "linux"))] { fn decode_stopped(pid: Pid, status: i32) -> Result { let status_additional = stop_additional(status); Ok(if syscall_stop(status) {