library: Use size_of from the prelude instead of imported

Use `std::mem::{size_of, size_of_val, align_of, align_of_val}` from the
prelude instead of importing or qualifying them.

These functions were added to all preludes in Rust 1.80.
This commit is contained in:
Thalia Archibald
2025-03-04 20:28:38 -08:00
parent 08db600e8e
commit 988eb19970
118 changed files with 392 additions and 486 deletions

View File

@@ -799,7 +799,7 @@ impl Command {
let fds: [c_int; 1] = [pidfd as RawFd];
const SCM_MSG_LEN: usize = mem::size_of::<[c_int; 1]>();
const SCM_MSG_LEN: usize = size_of::<[c_int; 1]>();
#[repr(C)]
union Cmsg {
@@ -818,7 +818,7 @@ impl Command {
// only attach cmsg if we successfully acquired the pidfd
if pidfd >= 0 {
msg.msg_controllen = mem::size_of_val(&cmsg.buf) as _;
msg.msg_controllen = size_of_val(&cmsg.buf) as _;
msg.msg_control = (&raw mut cmsg.buf) as *mut _;
let hdr = CMSG_FIRSTHDR((&raw mut msg) as *mut _);
@@ -850,7 +850,7 @@ impl Command {
use crate::sys::cvt_r;
unsafe {
const SCM_MSG_LEN: usize = mem::size_of::<[c_int; 1]>();
const SCM_MSG_LEN: usize = size_of::<[c_int; 1]>();
#[repr(C)]
union Cmsg {
@@ -865,7 +865,7 @@ impl Command {
msg.msg_iov = (&raw mut iov) as *mut _;
msg.msg_iovlen = 1;
msg.msg_controllen = mem::size_of::<Cmsg>() as _;
msg.msg_controllen = size_of::<Cmsg>() as _;
msg.msg_control = (&raw mut cmsg) as *mut _;
match cvt_r(|| libc::recvmsg(sock.as_raw(), &mut msg, libc::MSG_CMSG_CLOEXEC)) {