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
@@ -10,7 +10,6 @@
|
||||
|
||||
use std::fmt::{Display, Formatter, Result as FmtResult};
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
use std::mem::size_of;
|
||||
use std::str::FromStr;
|
||||
|
||||
use bitflags::bitflags;
|
||||
|
||||
@@ -17,7 +17,6 @@ use std::cmp::{max, min};
|
||||
use std::fmt::{Debug, Formatter, Result as FmtResult};
|
||||
use std::fs::{OpenOptions, read_link};
|
||||
use std::io::{self, Seek, SeekFrom};
|
||||
use std::mem::size_of;
|
||||
use std::os::fd::AsRawFd;
|
||||
use std::path::Path;
|
||||
use std::{result, str};
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
|
||||
use std::fmt::Debug;
|
||||
use std::io::{self, BufWriter, Read, Seek, SeekFrom, Write};
|
||||
use std::mem::size_of;
|
||||
use std::os::fd::{AsFd, AsRawFd, BorrowedFd, RawFd};
|
||||
|
||||
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
|
||||
@@ -364,14 +363,13 @@ impl AsFd for QcowRawFile {
|
||||
#[cfg(test)]
|
||||
mod unit_tests {
|
||||
use std::io::{Read, Seek, SeekFrom};
|
||||
use std::mem;
|
||||
|
||||
use vmm_sys_util::tempfile::TempFile;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn be_bytes(entries: &[u64]) -> Vec<u8> {
|
||||
let mut v = Vec::with_capacity(mem::size_of_val(entries));
|
||||
let mut v = Vec::with_capacity(size_of_val(entries));
|
||||
for e in entries {
|
||||
v.extend_from_slice(&e.to_be_bytes());
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use std::mem::size_of;
|
||||
use std::os::unix::fs::FileExt;
|
||||
use std::{io, result};
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use std::collections::btree_map::BTreeMap;
|
||||
use std::mem::size_of;
|
||||
use std::os::unix::fs::FileExt;
|
||||
use std::{io, result, slice};
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
use std::mem::size_of;
|
||||
use std::os::unix::fs::FileExt;
|
||||
use std::{io, result};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user