mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
misc: use prelude size_of
size_of is part of std::prelude as of Rust 1.80 (with size_of_val, align_of, align_of_val), and the workspace MSRV is 1.89, so qualifying it (mem::size_of, std::mem::size_of, core::mem::size_of) is unnecessary. Convert every qualified size_of call-site to the bare prelude form and drop the now-redundant `use std::mem::size_of;` imports, keeping `use std::mem;` where it still serves non-prelude items (transmute, swap, replace, take, zeroed, MaybeUninit, offset_of). size_of is the only one of the four currently used in the tree. Pure refactor, no behavioural change. Follow-up to the clippy::absolute_paths cleanup (#7670), as discussed in #8444. Signed-off-by: Henry Hrvoje Tonkovac <htonkovac@gmail.com> Assisted-by: Claude:Opus-4.8
This commit is contained in:
committed by
Bo Chen
parent
f56fa3a865
commit
f720e619c1
@@ -666,8 +666,7 @@ impl BlockEpollHandler {
|
||||
if let Some(cpuset) = cpuset.as_ref() {
|
||||
let cpuset: *const libc::cpu_set_t = cpuset;
|
||||
// SAFETY: FFI call with correct arguments
|
||||
let ret =
|
||||
unsafe { libc::sched_setaffinity(0, mem::size_of::<libc::cpu_set_t>(), cpuset) };
|
||||
let ret = unsafe { libc::sched_setaffinity(0, size_of::<libc::cpu_set_t>(), cpuset) };
|
||||
|
||||
if ret != 0 {
|
||||
error!(
|
||||
@@ -1148,7 +1147,7 @@ impl VirtioDevice for Block {
|
||||
// The "writeback" field is the only mutable field
|
||||
let writeback_offset =
|
||||
(&raw const self.config.writeback as u64) - (&raw const self.config as u64);
|
||||
if offset != writeback_offset || data.len() != mem::size_of_val(&self.config.writeback) {
|
||||
if offset != writeback_offset || data.len() != size_of_val(&self.config.writeback) {
|
||||
error!(
|
||||
"Attempt to write to read-only field: offset {:x} length {}",
|
||||
offset,
|
||||
|
||||
Reference in New Issue
Block a user