Rollup merge of #138034 - thaliaarchi:use-prelude-size-of, r=tgross35

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.

try-job: test-various
try-job: x86_64-gnu
try-job: x86_64-msvc-1
This commit is contained in:
Matthias Krüger
2025-03-07 10:12:44 +01:00
committed by GitHub
118 changed files with 402 additions and 496 deletions

View File

@@ -814,7 +814,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 {
@@ -833,7 +833,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 _);
@@ -865,7 +865,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 {
@@ -880,7 +880,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)) {