Use size_of/align_of from prelude

As of the 2024 edition, size_of/size_of_val/align_of/align_of_val are in the
prelude, so no need to import or use a fully qualified path.
This commit is contained in:
Nicholas Bishop 2025-08-02 16:37:20 -04:00
parent d30f3c3103
commit 7e0b8b3d5d
11 changed files with 10 additions and 20 deletions

View file

@ -1,6 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
use core::mem;
use uefi::Handle;
use uefi::boot::{OpenProtocolAttributes, OpenProtocolParams, ScopedProtocol, image_handle};
use uefi::proto::ProtocolPointer;
@ -11,7 +10,7 @@ const RED_HAT_PCI_VENDOR_ID: u16 = 0x1AF4;
const MASS_STORAGE_CTRL_CLASS_CODE: u8 = 0x1;
const SATA_CTRL_SUBCLASS_CODE: u8 = 0x6;
const REG_SIZE: u8 = mem::size_of::<u32>() as u8;
const REG_SIZE: u8 = size_of::<u32>() as u8;
pub fn test() {
let pci_handles = uefi::boot::find_handles::<PciRootBridgeIo>().unwrap();

View file

@ -1,6 +1,5 @@
// SPDX-License-Identifier: MIT OR Apache-2.0
use core::mem;
use uefi::proto::usb::DeviceDescriptor;
use uefi::proto::usb::io::{ControlTransfer, UsbIo};
use uefi::{Status, boot};
@ -61,14 +60,14 @@ pub fn test() {
result.expect("failed to acquire string descriptor");
}
let mut buffer = [0u8; mem::size_of::<DeviceDescriptor>()];
let mut buffer = [0u8; size_of::<DeviceDescriptor>()];
io.control_transfer(
DEVICE_TO_HOST | STANDARD_REQUEST | DEVICE_RECIPIENT,
GET_DESCRIPTOR_REQUEST,
u16::from(DEVICE_DESCRIPTOR) << 8,
0,
ControlTransfer::DataIn(&mut buffer[..mem::size_of::<DeviceDescriptor>()]),
ControlTransfer::DataIn(&mut buffer[..size_of::<DeviceDescriptor>()]),
0,
)
.expect("failed control transfer");