From a56aab7065f5d9af275de791c0e48ed0e09b2ea2 Mon Sep 17 00:00:00 2001 From: Trevor Gross Date: Mon, 25 Nov 2024 04:39:53 -0500 Subject: [PATCH] style: Run `cargo fmt` with the new configuration `libc-0.2` version of 236e0697ef796b263c751321ce68b15ca137d09f from [1] (not a direct cherry pick). [1]: https://github.com/rust-lang/libc/pull/4136 --- build.rs | 3 +-- libc-test/test/cmsg.rs | 3 ++- src/lib.rs | 3 +-- src/unix/linux_like/emscripten/lfs64.rs | 3 +-- src/unix/linux_like/linux/musl/lfs64.rs | 3 +-- src/unix/nuttx/mod.rs | 6 +----- src/unix/solarish/compat.rs | 1 + src/unix/solarish/illumos.rs | 11 ++++------- src/unix/solarish/solaris.rs | 11 ++++------- src/vxworks/mod.rs | 3 ++- src/wasi/mod.rs | 3 ++- 11 files changed, 20 insertions(+), 30 deletions(-) diff --git a/build.rs b/build.rs index 8b599183f5ec9..fe3b65e44b786 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 8af17cb0cb582..b0b25de44e5d8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,6 +47,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)] @@ -62,8 +63,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 8f271b71d4ead..a2a7b1a60e6f3 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 4c4f6c1b4de2c..8aaa6171f2cca 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 0e9f6377cf083..e8580048dfed0 100644 --- a/src/wasi/mod.rs +++ b/src/wasi/mod.rs @@ -5,9 +5,10 @@ use core::iter::Iterator; -use super::{Send, Sync}; use c_void; +use super::{Send, Sync}; + pub type c_char = i8; pub type c_uchar = u8; pub type c_schar = i8;