Skip to content

Hurd clippy fixes #4498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 17, 2025
Merged
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
20 changes: 9 additions & 11 deletions src/unix/hurd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1594,12 +1594,12 @@ pub const SEM_VALUE_MAX: c_int = 2147483647;
pub const MAXNAMLEN: usize = 255;

// netdb.h
pub const _PATH_HEQUIV: &'static [u8; 17usize] = b"/etc/hosts.equiv\0";
pub const _PATH_HOSTS: &'static [u8; 11usize] = b"/etc/hosts\0";
pub const _PATH_NETWORKS: &'static [u8; 14usize] = b"/etc/networks\0";
pub const _PATH_NSSWITCH_CONF: &'static [u8; 19usize] = b"/etc/nsswitch.conf\0";
pub const _PATH_PROTOCOLS: &'static [u8; 15usize] = b"/etc/protocols\0";
pub const _PATH_SERVICES: &'static [u8; 14usize] = b"/etc/services\0";
pub const _PATH_HEQUIV: &[u8; 17usize] = b"/etc/hosts.equiv\0";
pub const _PATH_HOSTS: &[u8; 11usize] = b"/etc/hosts\0";
pub const _PATH_NETWORKS: &[u8; 14usize] = b"/etc/networks\0";
pub const _PATH_NSSWITCH_CONF: &[u8; 19usize] = b"/etc/nsswitch.conf\0";
pub const _PATH_PROTOCOLS: &[u8; 15usize] = b"/etc/protocols\0";
pub const _PATH_SERVICES: &[u8; 14usize] = b"/etc/services\0";
pub const HOST_NOT_FOUND: c_int = 1;
pub const TRY_AGAIN: c_int = 2;
pub const NO_RECOVERY: c_int = 3;
Expand Down Expand Up @@ -3416,15 +3416,15 @@ const _UTSNAME_LENGTH: usize = 1024;

const_fn! {
{const} fn CMSG_ALIGN(len: usize) -> usize {
len + mem::size_of::<usize>() - 1 & !(mem::size_of::<usize>() - 1)
(len + mem::size_of::<usize>() - 1) & !(mem::size_of::<usize>() - 1)
}
}

// functions
f! {
pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
if (*mhdr).msg_controllen as usize >= mem::size_of::<cmsghdr>() {
(*mhdr).msg_control as *mut cmsghdr
(*mhdr).msg_control.cast::<cmsghdr>()
} else {
core::ptr::null_mut::<cmsghdr>()
}
Expand Down Expand Up @@ -3453,7 +3453,7 @@ f! {
{
core::ptr::null_mut::<cmsghdr>()
} else {
next as *mut cmsghdr
next.cast::<cmsghdr>()
}
}

Expand All @@ -3473,14 +3473,12 @@ f! {
let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
cpuset.bits[idx] |= 1 << offset;
()
}

pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
let size_in_bits = 8 * mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
cpuset.bits[idx] &= !(1 << offset);
()
}

pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
Expand Down
Loading