diff --git a/build.rs b/build.rs index d0675be18191b..ec94931bd7b1f 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,5 @@ -use std::env; use std::process::{Command, Output}; -use std::str; +use std::{env, str}; // List of cfgs this build script is allowed to set. The list is needed to support check-cfg, as we // need to know all the possible cfgs that this script will set. If you need to set another cfg diff --git a/libc-test/test/cmsg.rs b/libc-test/test/cmsg.rs index 52bf9830212c2..130b143cf9dbd 100644 --- a/libc-test/test/cmsg.rs +++ b/libc-test/test/cmsg.rs @@ -4,9 +4,10 @@ #[cfg(unix)] mod t { - use libc::{self, c_uchar, c_uint, c_void, cmsghdr, msghdr}; use std::mem; + use libc::{self, c_uchar, c_uint, c_void, cmsghdr, msghdr}; + extern "C" { pub fn cmsg_firsthdr(msgh: *const msghdr) -> *mut cmsghdr; // see below diff --git a/src/lib.rs b/src/lib.rs index 488b698556df3..4b7b77f46d346 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,6 +46,7 @@ cfg_if! { use core::clone::Clone; #[allow(unused_imports)] use core::ffi; +pub use core::ffi::c_void; #[allow(unused_imports)] use core::fmt; #[allow(unused_imports)] @@ -61,8 +62,6 @@ use core::num; #[allow(unused_imports)] use core::option::Option; -pub use core::ffi::c_void; - cfg_if! { if #[cfg(windows)] { mod fixed_width_ints; diff --git a/src/unix/linux_like/emscripten/lfs64.rs b/src/unix/linux_like/emscripten/lfs64.rs index 1616cc90494be..c4cdfb849a2ff 100644 --- a/src/unix/linux_like/emscripten/lfs64.rs +++ b/src/unix/linux_like/emscripten/lfs64.rs @@ -106,8 +106,7 @@ pub unsafe extern "C" fn mmap64( // // These aliases are mostly fine though, neither function takes a LFS64-namespaced type as an // argument, nor do their names clash with any declared types. -pub use open as open64; -pub use openat as openat64; +pub use {open as open64, openat as openat64}; #[inline] pub unsafe extern "C" fn posix_fadvise64( diff --git a/src/unix/linux_like/linux/musl/lfs64.rs b/src/unix/linux_like/linux/musl/lfs64.rs index 27c1d25836d68..6d1f368695a6b 100644 --- a/src/unix/linux_like/linux/musl/lfs64.rs +++ b/src/unix/linux_like/linux/musl/lfs64.rs @@ -114,8 +114,7 @@ pub unsafe extern "C" fn mmap64( // // These aliases are mostly fine though, neither function takes a LFS64-namespaced type as an // argument, nor do their names clash with any declared types. -pub use open as open64; -pub use openat as openat64; +pub use {open as open64, openat as openat64}; #[inline] pub unsafe extern "C" fn posix_fadvise64( diff --git a/src/unix/nuttx/mod.rs b/src/unix/nuttx/mod.rs index c5eb030c9c2bb..200a795ff87ea 100644 --- a/src/unix/nuttx/mod.rs +++ b/src/unix/nuttx/mod.rs @@ -1,8 +1,4 @@ -use c_void; -use in6_addr; -use in_addr_t; -use timespec; -use DIR; +use {c_void, in6_addr, in_addr_t, timespec, DIR}; pub type nlink_t = u16; pub type ino_t = u16; diff --git a/src/unix/solarish/compat.rs b/src/unix/solarish/compat.rs index cbf955a31edaa..72d1bb436794e 100644 --- a/src/unix/solarish/compat.rs +++ b/src/unix/solarish/compat.rs @@ -2,6 +2,7 @@ // Solaris, but often needed by other crates. use core::cmp::min; + use unix::solarish::*; const PTEM: &[u8] = b"ptem\0"; diff --git a/src/unix/solarish/illumos.rs b/src/unix/solarish/illumos.rs index 16a3ba6661e65..cfdb2d16df034 100644 --- a/src/unix/solarish/illumos.rs +++ b/src/unix/solarish/illumos.rs @@ -1,10 +1,7 @@ -use exit_status; -use NET_MAC_AWARE; -use NET_MAC_AWARE_INHERIT; -use PRIV_AWARE_RESET; -use PRIV_DEBUG; -use PRIV_PFEXEC; -use PRIV_XPOLICY; +use { + exit_status, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG, PRIV_PFEXEC, + PRIV_XPOLICY, +}; pub type lgrp_rsrc_t = ::c_int; pub type lgrp_affinity_t = ::c_int; diff --git a/src/unix/solarish/solaris.rs b/src/unix/solarish/solaris.rs index eb7aa8654f964..a13637604870c 100644 --- a/src/unix/solarish/solaris.rs +++ b/src/unix/solarish/solaris.rs @@ -1,10 +1,7 @@ -use exit_status; -use NET_MAC_AWARE; -use NET_MAC_AWARE_INHERIT; -use PRIV_AWARE_RESET; -use PRIV_DEBUG; -use PRIV_PFEXEC; -use PRIV_XPOLICY; +use { + exit_status, NET_MAC_AWARE, NET_MAC_AWARE_INHERIT, PRIV_AWARE_RESET, PRIV_DEBUG, PRIV_PFEXEC, + PRIV_XPOLICY, +}; pub type door_attr_t = ::c_uint; pub type door_id_t = ::c_ulonglong; diff --git a/src/vxworks/mod.rs b/src/vxworks/mod.rs index aaeed94b9cdfb..f863d211b0883 100644 --- a/src/vxworks/mod.rs +++ b/src/vxworks/mod.rs @@ -1,9 +1,10 @@ //! Interface to VxWorks C library -use c_void; use core::mem::size_of; use core::ptr::null_mut; +use c_void; + #[cfg_attr(feature = "extra_traits", derive(Debug))] pub enum DIR {} impl ::Copy for DIR {} diff --git a/src/wasi/mod.rs b/src/wasi/mod.rs index 2c44e8399349e..16024cdcc4ab0 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -3,10 +3,12 @@ //! `wasi-libc` project provides multiple libraries including emulated features, but we list only //! basic features with `libc.a` here. -use super::{Send, Sync}; -use c_void; use core::iter::Iterator; +use c_void; + +use super::{Send, Sync}; + pub type c_char = i8; pub type c_uchar = u8; pub type c_schar = i8;