compiler: 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 ac951d3799
commit 38fad984c6
30 changed files with 64 additions and 74 deletions

View file

@ -863,15 +863,13 @@ fn get_thread_id() -> u32 {
cfg_match! {
windows => {
pub fn get_resident_set_size() -> Option<usize> {
use std::mem;
use windows::{
Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS},
Win32::System::Threading::GetCurrentProcess,
};
let mut pmc = PROCESS_MEMORY_COUNTERS::default();
let pmc_size = mem::size_of_val(&pmc);
let pmc_size = size_of_val(&pmc);
unsafe {
K32GetProcessMemoryInfo(
GetCurrentProcess(),
@ -889,7 +887,7 @@ cfg_match! {
pub fn get_resident_set_size() -> Option<usize> {
use libc::{c_int, c_void, getpid, proc_pidinfo, proc_taskinfo, PROC_PIDTASKINFO};
use std::mem;
const PROC_TASKINFO_SIZE: c_int = mem::size_of::<proc_taskinfo>() as c_int;
const PROC_TASKINFO_SIZE: c_int = size_of::<proc_taskinfo>() as c_int;
unsafe {
let mut info: proc_taskinfo = mem::zeroed();