summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryant Mairs <bryantmairs@google.com>2018-01-14 09:28:41 -0800
committerBryant Mairs <bryantmairs@google.com>2018-01-28 15:35:35 -0800
commit914cda7cc984c79165d5038e07132fdb94780cee (patch)
tree8ef7939c274416cad52cdb94511f4e1a6caf9aea
parent899eff72f92cbc300fbd7779957907a39aa0e42b (diff)
downloadnix-914cda7cc984c79165d5038e07132fdb94780cee.zip
Deny unused qualifications
-rw-r--r--src/fcntl.rs4
-rw-r--r--src/lib.rs3
-rw-r--r--src/sched.rs2
-rw-r--r--src/sys/epoll.rs4
-rw-r--r--src/sys/event.rs2
-rw-r--r--src/sys/mman.rs2
-rw-r--r--src/sys/ptrace.rs4
-rw-r--r--src/sys/select.rs2
-rw-r--r--src/sys/socket/mod.rs2
-rw-r--r--src/sys/statvfs.rs6
-rw-r--r--src/sys/termios.rs2
-rw-r--r--src/sys/time.rs16
-rw-r--r--src/unistd.rs10
13 files changed, 30 insertions, 29 deletions
diff --git a/src/fcntl.rs b/src/fcntl.rs
index fa96491f..a42a2201 100644
--- a/src/fcntl.rs
+++ b/src/fcntl.rs
@@ -230,7 +230,7 @@ pub enum FcntlArg<'a> {
#[cfg(any(target_os = "linux", target_os = "android"))]
F_GETPIPE_SZ,
#[cfg(any(target_os = "linux", target_os = "android"))]
- F_SETPIPE_SZ(libc::c_int),
+ F_SETPIPE_SZ(c_int),
// TODO: Rest of flags
}
@@ -343,7 +343,7 @@ pub fn vmsplice(fd: RawFd, iov: &[IoVec<&[u8]>], flags: SpliceFFlags) -> Result<
#[cfg(any(target_os = "linux"))]
libc_bitflags!(
/// Mode argument flags for fallocate determining operation performed on a given range.
- pub struct FallocateFlags: libc::c_int {
+ pub struct FallocateFlags: c_int {
/// File size is not changed.
///
/// offset + len can be greater than file size.
diff --git a/src/lib.rs b/src/lib.rs
index 5aaebc40..9347e393 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -10,6 +10,7 @@
#![allow(dead_code)]
#![cfg_attr(test, deny(warnings))]
#![recursion_limit = "500"]
+#![deny(unused_qualifications)]
extern crate bytes;
#[macro_use]
@@ -94,7 +95,7 @@ pub type Result<T> = result::Result<T, Error>;
/// implementing other common traits.
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Error {
- Sys(errno::Errno),
+ Sys(Errno),
InvalidPath,
/// The operation involved a conversion to Rust's native String type, which failed because the
/// string did not contain all valid UTF-8.
diff --git a/src/sched.rs b/src/sched.rs
index 9de1bd10..17c32c44 100644
--- a/src/sched.rs
+++ b/src/sched.rs
@@ -9,7 +9,7 @@ use ::unistd::Pid;
// For some functions taking with a parameter of type CloneFlags,
// only a subset of these flags have an effect.
libc_bitflags!{
- pub struct CloneFlags: libc::c_int {
+ pub struct CloneFlags: c_int {
CLONE_VM;
CLONE_FS;
CLONE_FILES;
diff --git a/src/sys/epoll.rs b/src/sys/epoll.rs
index c6c2eab3..296e9771 100644
--- a/src/sys/epoll.rs
+++ b/src/sys/epoll.rs
@@ -7,7 +7,7 @@ use std::mem;
use ::Error;
libc_bitflags!(
- pub struct EpollFlags: libc::c_int {
+ pub struct EpollFlags: c_int {
EPOLLIN;
EPOLLPRI;
EPOLLOUT;
@@ -58,7 +58,7 @@ impl EpollEvent {
}
pub fn events(&self) -> EpollFlags {
- EpollFlags::from_bits(self.event.events as libc::c_int).unwrap()
+ EpollFlags::from_bits(self.event.events as c_int).unwrap()
}
pub fn data(&self) -> u64 {
diff --git a/src/sys/event.rs b/src/sys/event.rs
index 4d5d1880..16b4d7dc 100644
--- a/src/sys/event.rs
+++ b/src/sys/event.rs
@@ -24,7 +24,7 @@ pub struct KEvent {
type type_of_udata = *mut libc::c_void;
#[cfg(any(target_os = "dragonfly", target_os = "freebsd",
target_os = "ios", target_os = "macos"))]
-type type_of_data = libc::intptr_t;
+type type_of_data = intptr_t;
#[cfg(any(target_os = "netbsd"))]
type type_of_udata = intptr_t;
#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
diff --git a/src/sys/mman.rs b/src/sys/mman.rs
index 65f6c59d..5b4bd4f5 100644
--- a/src/sys/mman.rs
+++ b/src/sys/mman.rs
@@ -7,7 +7,7 @@ use std::os::unix::io::RawFd;
libc_bitflags!{
/// Desired memory protection of a memory mapping.
- pub struct ProtFlags: libc::c_int {
+ pub struct ProtFlags: c_int {
/// Pages cannot be accessed.
PROT_NONE;
/// Pages can be read.
diff --git a/src/sys/ptrace.rs b/src/sys/ptrace.rs
index 8fb8f823..90c12e43 100644
--- a/src/sys/ptrace.rs
+++ b/src/sys/ptrace.rs
@@ -178,7 +178,7 @@ pub fn setoptions(pid: Pid, options: Options) -> Result<()> {
let res = unsafe {
libc::ptrace(Request::PTRACE_SETOPTIONS as RequestType,
libc::pid_t::from(pid),
- ptr::null_mut::<libc::c_void>(),
+ ptr::null_mut::<c_void>(),
options.bits() as *mut c_void)
};
Errno::result(res).map(|_| ())
@@ -200,7 +200,7 @@ pub fn setsiginfo(pid: Pid, sig: &siginfo_t) -> Result<()> {
Errno::clear();
libc::ptrace(Request::PTRACE_SETSIGINFO as RequestType,
libc::pid_t::from(pid),
- ptr::null_mut::<libc::c_void>(),
+ ptr::null_mut::<c_void>(),
sig as *const _ as *const c_void)
};
match Errno::result(ret) {
diff --git a/src/sys/select.rs b/src/sys/select.rs
index 6fe176ae..5b88c997 100644
--- a/src/sys/select.rs
+++ b/src/sys/select.rs
@@ -56,7 +56,7 @@ impl FdSet {
///
/// [`select`]: fn.select.html
pub fn highest(&mut self) -> Option<RawFd> {
- for i in (0..libc::FD_SETSIZE).rev() {
+ for i in (0..FD_SETSIZE).rev() {
let i = i as RawFd;
if unsafe { libc::FD_ISSET(i, self as *mut _ as *mut libc::fd_set) } {
return Some(i)
diff --git a/src/sys/socket/mod.rs b/src/sys/socket/mod.rs
index 7c62c739..5c4f19b2 100644
--- a/src/sys/socket/mod.rs
+++ b/src/sys/socket/mod.rs
@@ -117,7 +117,7 @@ libc_bitflags!{
libc_bitflags!{
/// Flags for send/recv and their relatives
- pub struct MsgFlags: libc::c_int {
+ pub struct MsgFlags: c_int {
/// Sends or requests out-of-band data on sockets that support this notion
/// (e.g., of type [`Stream`](enum.SockType.html)); the underlying protocol must also
/// support out-of-band data.
diff --git a/src/sys/statvfs.rs b/src/sys/statvfs.rs
index fbd0570e..e4b00b37 100644
--- a/src/sys/statvfs.rs
+++ b/src/sys/statvfs.rs
@@ -61,12 +61,12 @@ pub struct Statvfs(libc::statvfs);
impl Statvfs {
/// get the file system block size
- pub fn block_size(&self) -> libc::c_ulong {
+ pub fn block_size(&self) -> c_ulong {
self.0.f_bsize
}
/// Get the fundamental file system block size
- pub fn fragment_size(&self) -> libc::c_ulong {
+ pub fn fragment_size(&self) -> c_ulong {
self.0.f_frsize
}
@@ -113,7 +113,7 @@ impl Statvfs {
}
/// Get the maximum filename length
- pub fn name_max(&self) -> libc::c_ulong {
+ pub fn name_max(&self) -> c_ulong {
self.0.f_namemax
}
diff --git a/src/sys/termios.rs b/src/sys/termios.rs
index 962377d5..ec5e302b 100644
--- a/src/sys/termios.rs
+++ b/src/sys/termios.rs
@@ -188,7 +188,7 @@ pub struct Termios {
/// Local mode flags (see `termios.c_lflag` documentation)
pub local_flags: LocalFlags,
/// Control characters (see `termios.c_cc` documentation)
- pub control_chars: [libc::cc_t; libc::NCCS],
+ pub control_chars: [libc::cc_t; NCCS],
}
impl Termios {
diff --git a/src/sys/time.rs b/src/sys/time.rs
index 0d977045..51286a06 100644
--- a/src/sys/time.rs
+++ b/src/sys/time.rs
@@ -74,7 +74,7 @@ impl fmt::Debug for TimeSpec {
}
}
-impl cmp::PartialEq for TimeSpec {
+impl PartialEq for TimeSpec {
// The implementation of cmp is simplified by assuming that the struct is
// normalized. That is, tv_nsec must always be within [0, 1_000_000_000)
fn eq(&self, other: &TimeSpec) -> bool {
@@ -82,9 +82,9 @@ impl cmp::PartialEq for TimeSpec {
}
}
-impl cmp::Eq for TimeSpec {}
+impl Eq for TimeSpec {}
-impl cmp::Ord for TimeSpec {
+impl Ord for TimeSpec {
// The implementation of cmp is simplified by assuming that the struct is
// normalized. That is, tv_nsec must always be within [0, 1_000_000_000)
fn cmp(&self, other: &TimeSpec) -> cmp::Ordering {
@@ -96,7 +96,7 @@ impl cmp::Ord for TimeSpec {
}
}
-impl cmp::PartialOrd for TimeSpec {
+impl PartialOrd for TimeSpec {
fn partial_cmp(&self, other: &TimeSpec) -> Option<cmp::Ordering> {
Some(self.cmp(other))
}
@@ -285,7 +285,7 @@ impl fmt::Debug for TimeVal {
}
}
-impl cmp::PartialEq for TimeVal {
+impl PartialEq for TimeVal {
// The implementation of cmp is simplified by assuming that the struct is
// normalized. That is, tv_usec must always be within [0, 1_000_000)
fn eq(&self, other: &TimeVal) -> bool {
@@ -293,9 +293,9 @@ impl cmp::PartialEq for TimeVal {
}
}
-impl cmp::Eq for TimeVal {}
+impl Eq for TimeVal {}
-impl cmp::Ord for TimeVal {
+impl Ord for TimeVal {
// The implementation of cmp is simplified by assuming that the struct is
// normalized. That is, tv_usec must always be within [0, 1_000_000)
fn cmp(&self, other: &TimeVal) -> cmp::Ordering {
@@ -307,7 +307,7 @@ impl cmp::Ord for TimeVal {
}
}
-impl cmp::PartialOrd for TimeVal {
+impl PartialOrd for TimeVal {
fn partial_cmp(&self, other: &TimeVal) -> Option<cmp::Ordering> {
Some(self.cmp(other))
}
diff --git a/src/unistd.rs b/src/unistd.rs
index 0f47a7fc..4649ae3b 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -503,14 +503,14 @@ pub fn getcwd() -> Result<PathBuf> {
let mut buf = Vec::with_capacity(512);
loop {
unsafe {
- let ptr = buf.as_mut_ptr() as *mut libc::c_char;
+ let ptr = buf.as_mut_ptr() as *mut c_char;
// The buffer must be large enough to store the absolute pathname plus
// a terminating null byte, or else null is returned.
// To safely handle this we start with a reasonable size (512 bytes)
// and double the buffer size upon every error
if !libc::getcwd(ptr, buf.capacity()).is_null() {
- let len = CStr::from_ptr(buf.as_ptr() as *const libc::c_char).to_bytes().len();
+ let len = CStr::from_ptr(buf.as_ptr() as *const c_char).to_bytes().len();
buf.set_len(len);
buf.shrink_to_fit();
return Ok(PathBuf::from(OsString::from_vec(buf)));
@@ -852,10 +852,10 @@ pub enum Whence {
/// Move the read/write file offset.
///
/// See also [lseek(2)](http://pubs.opengroup.org/onlinepubs/9699919799/functions/lseek.html)
-pub fn lseek(fd: RawFd, offset: libc::off_t, whence: Whence) -> Result<libc::off_t> {
+pub fn lseek(fd: RawFd, offset: off_t, whence: Whence) -> Result<off_t> {
let res = unsafe { libc::lseek(fd, offset, whence as i32) };
- Errno::result(res).map(|r| r as libc::off_t)
+ Errno::result(res).map(|r| r as off_t)
}
#[cfg(any(target_os = "linux", target_os = "android"))]
@@ -1329,7 +1329,7 @@ pub fn pause() {
/// See also [sleep(2)](http://pubs.opengroup.org/onlinepubs/009695399/functions/sleep.html#tag_03_705_05)
// Per POSIX, does not fail
#[inline]
-pub fn sleep(seconds: libc::c_uint) -> c_uint {
+pub fn sleep(seconds: c_uint) -> c_uint {
unsafe { libc::sleep(seconds) }
}