Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ while IFS= read -r file; do
# Format the file. We need to invoke `rustfmt` directly since `cargo fmt`
# can't figure out the module tree with the hacks in place.
failed=false
rustfmt --config-path rustfmt.toml "$file" ${check:+"$check"} || failed=true
rustfmt "$file" ${check:+"$check"} || failed=true

# Restore all changes to the files.
perl -pi -e 's/fn (\w+)_fmt_tmp\(\)/$1!/g' "$file"
Expand Down
1 change: 1 addition & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Note that there is a separate configuration for `src/`
edition = "2021"
error_on_line_overflow = true
group_imports = "StdExternalCrate"
Expand Down
45 changes: 39 additions & 6 deletions src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,59 @@ macro_rules! prelude {
#[allow(unused_imports)]
pub(crate) use core::default::Default;
#[allow(unused_imports)]
pub(crate) use core::marker::{Copy, Send, Sync};
pub(crate) use core::marker::{
Copy,
Send,
Sync,
};
#[allow(unused_imports)]
pub(crate) use core::option::Option;
#[allow(unused_imports)]
pub(crate) use core::prelude::v1::derive;
#[allow(unused_imports)]
pub(crate) use core::{fmt, hash, iter, mem, ptr};
pub(crate) use core::{
fmt,
hash,
iter,
mem,
ptr,
};

#[allow(unused_imports)]
pub(crate) use fmt::Debug;
#[allow(unused_imports)]
pub(crate) use mem::{align_of, align_of_val, size_of, size_of_val};
pub(crate) use mem::{
align_of,
align_of_val,
size_of,
size_of_val,
};

#[allow(unused_imports)]
pub(crate) use crate::types::{CEnumRepr, Padding};
pub(crate) use crate::types::{
CEnumRepr,
Padding,
};
// Commonly used types defined in this crate
#[allow(unused_imports)]
pub(crate) use crate::{
c_char, c_double, c_float, c_int, c_long, c_longlong, c_short, c_uchar, c_uint,
c_ulong, c_ulonglong, c_ushort, c_void, intptr_t, size_t, ssize_t, uintptr_t,
c_char,
c_double,
c_float,
c_int,
c_long,
c_longlong,
c_short,
c_uchar,
c_uint,
c_ulong,
c_ulonglong,
c_ushort,
c_void,
intptr_t,
size_t,
ssize_t,
uintptr_t,
};
}
};
Expand Down
7 changes: 7 additions & 0 deletions src/rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Note that there is a separate top-level configuration for everything else
edition = "2021"
error_on_line_overflow = true
group_imports = "StdExternalCrate"
imports_granularity = "Module"
# This crate gets large lists of reexports. Use vertical to reduce conflicts.
imports_layout = "Vertical"
5 changes: 4 additions & 1 deletion src/unix/aix/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{in_addr_t, in_port_t};
use crate::{
in_addr_t,
in_port_t,
};

pub type caddr_t = *mut c_char;
pub type clockid_t = c_longlong;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
//! This covers *-apple-* triples currently

use crate::prelude::*;
use crate::{cmsghdr, off_t};
use crate::{
cmsghdr,
off_t,
};

pub type wchar_t = i32;
pub type clock_t = c_ulong;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/bsd/freebsdlike/dragonfly/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{cmsghdr, off_t};
use crate::{
cmsghdr,
off_t,
};

pub type dev_t = u32;
pub type wchar_t = i32;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/bsd/freebsdlike/freebsd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{cmsghdr, off_t};
use crate::{
cmsghdr,
off_t,
};

pub type fflags_t = u32;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/bsd/netbsdlike/netbsd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{cmsghdr, off_t};
use crate::{
cmsghdr,
off_t,
};

pub type clock_t = c_uint;
pub type suseconds_t = c_int;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/bsd/netbsdlike/openbsd/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
use crate::prelude::*;
use crate::unix::bsd::O_SYNC;
use crate::{cmsghdr, off_t};
use crate::{
cmsghdr,
off_t,
};

pub type clock_t = i64;
pub type suseconds_t = c_long;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! Android-specific definitions for linux-like values

use crate::prelude::*;
use crate::{cmsghdr, msghdr};
use crate::{
cmsghdr,
msghdr,
};

cfg_if! {
if #[cfg(doc)] {
Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/emscripten/lfs64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ 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 crate::{open as open64, openat as openat64};
pub use crate::{
open as open64,
openat as openat64,
};

#[inline]
pub unsafe extern "C" fn posix_fadvise64(
Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b32/arm/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = u32;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b32/csky/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = u32;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b32/m68k/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = i32;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b32/mips/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = i32;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b32/powerpc.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = i32;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! RISC-V-specific definitions for 32-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = c_int;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b32/sparc/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! SPARC-specific definitions for 32-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = i32;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b32/x86/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = i32;
pub type greg_t = i32;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! AArch64-specific definitions for 64-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = u32;
pub type nlink_t = u32;
Expand Down
6 changes: 5 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use crate::prelude::*;
use crate::{off64_t, off_t, pthread_mutex_t};
use crate::{
off64_t,
off_t,
pthread_mutex_t,
};

pub type wchar_t = i32;

Expand Down
6 changes: 5 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/mips64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
use crate::prelude::*;
use crate::{off64_t, off_t, pthread_mutex_t};
use crate::{
off64_t,
off_t,
pthread_mutex_t,
};

pub type blksize_t = i64;
pub type nlink_t = u64;
Expand Down
6 changes: 5 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
//! PowerPC64-specific definitions for 64-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t, pthread_mutex_t};
use crate::{
off64_t,
off_t,
pthread_mutex_t,
};

pub type wchar_t = i32;
pub type nlink_t = u64;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! RISC-V-specific definitions for 64-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = c_int;

Expand Down
6 changes: 5 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/s390x.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
//! s390x

use crate::prelude::*;
use crate::{off64_t, off_t, pthread_mutex_t};
use crate::{
off64_t,
off_t,
pthread_mutex_t,
};

pub type blksize_t = i64;
pub type nlink_t = u64;
Expand Down
6 changes: 5 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
//! SPARC64-specific definitions for 64-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t, pthread_mutex_t};
use crate::{
off64_t,
off_t,
pthread_mutex_t,
};

pub type wchar_t = i32;
pub type nlink_t = u32;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! x86_64-specific definitions for 64-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = i32;
pub type nlink_t = u64;
Expand Down
8 changes: 7 additions & 1 deletion src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
//! Linux-specific definitions for linux-like values

use crate::prelude::*;
use crate::{sock_filter, _IO, _IOR, _IOW, _IOWR};
use crate::{
sock_filter,
_IO,
_IOR,
_IOW,
_IOWR,
};

pub type useconds_t = u32;
pub type dev_t = u64;
Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/musl/b32/riscv32/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! RISC-V-specific definitions for 32-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = c_int;

Expand Down
5 changes: 4 additions & 1 deletion src/unix/linux_like/linux/musl/b64/loongarch64/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! LoongArch-specific definitions for 64-bit linux-like values

use crate::prelude::*;
use crate::{off64_t, off_t};
use crate::{
off64_t,
off_t,
};

pub type wchar_t = c_int;

Expand Down
Loading
Loading