Remove unnecessary qualification from size_of

Closes #12339
This commit is contained in:
xtqqczze
2026-01-17 01:04:45 +00:00
committed by Johannes Altmanninger
parent 66ea0f78be
commit 9dfb5705c5
5 changed files with 6 additions and 12 deletions

View File

@@ -202,7 +202,7 @@ fn source<'s>(&self, orig: &'s wstr) -> &'s wstr {
/// The raw byte size of this node, excluding children.
/// This also excludes the allocations stored in lists.
fn self_memory_size(&self) -> usize {
std::mem::size_of_val(self)
size_of_val(self)
}
}

View File

@@ -1166,7 +1166,7 @@ fn expand_home_directory(input: &mut WString, vars: &dyn Environment) {
name_cstr.as_ptr(),
userinfo.as_mut_ptr(),
&mut buf[0],
std::mem::size_of_val(&buf),
size_of_val(&buf),
&mut result,
)
};

View File

@@ -88,13 +88,8 @@ pub fn try_consume(&self) -> bool {
);
let mut ret;
loop {
ret = unsafe {
libc::read(
self.read_fd(),
buff.as_mut_ptr().cast(),
std::mem::size_of_val(&buff),
)
};
ret =
unsafe { libc::read(self.read_fd(), buff.as_mut_ptr().cast(), size_of_val(&buff)) };
if ret >= 0 || errno().0 != EINTR {
break;
}

View File

@@ -503,7 +503,7 @@ fn get_interpreter<'a>(command: &CStr, buffer: &'a mut [u8]) -> Option<&'a CStr>
if fd >= 0 {
while idx + 1 < buffer.len() {
let mut ch = b'\0';
let amt = unsafe { libc::read(fd, (&raw mut ch).cast(), std::mem::size_of_val(&ch)) };
let amt = unsafe { libc::read(fd, (&raw mut ch).cast(), size_of_val(&ch)) };
if amt <= 0 || ch == b'\n' {
break;
}

View File

@@ -420,8 +420,7 @@ pub fn read_once(fd: RawFd, buffer: &mut MutexGuard<'_, SeparatedBuffer>) -> isi
// We want to swallow EINTR only; in particular EAGAIN needs to be returned back to the caller.
let amt = loop {
let amt =
unsafe { libc::read(fd, bytes.as_mut_ptr().cast(), std::mem::size_of_val(&bytes)) };
let amt = unsafe { libc::read(fd, bytes.as_mut_ptr().cast(), size_of_val(&bytes)) };
if amt < 0 && errno::errno().0 == EINTR {
continue;
}