diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 00000000..f396ceb5 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,8 @@ +# We keep this file explicitley to ensure that direct invocations of `rustfmt` +# also use the proper style edition. Unlike `cargo fmt`, which forwards the +# Rust edition specified in Cargo.toml to `rustfmt`, `rustfmt` still defaults to +# the 2021 edition and is unaware of `Cargo.toml`. +# +# We use a direct invocation of `rustfmt` in our device path generation code. + +style_edition = "2024" diff --git a/uefi-raw/src/protocol/device_path/device_path_gen.rs b/uefi-raw/src/protocol/device_path/device_path_gen.rs index 9914779c..825a2792 100644 --- a/uefi-raw/src/protocol/device_path/device_path_gen.rs +++ b/uefi-raw/src/protocol/device_path/device_path_gen.rs @@ -10,7 +10,7 @@ #![allow(missing_debug_implementations)] use crate::protocol::device_path; use crate::table::boot::MemoryType; -use crate::{guid, Guid, IpAddress}; +use crate::{Guid, IpAddress, guid}; use bitflags::bitflags; use device_path::DevicePathProtocol as DevicePathHeader; #[cfg(doc)] diff --git a/uefi/src/proto/device_path/device_path_gen.rs b/uefi/src/proto/device_path/device_path_gen.rs index ef02e1da..9b0c35f3 100644 --- a/uefi/src/proto/device_path/device_path_gen.rs +++ b/uefi/src/proto/device_path/device_path_gen.rs @@ -15,7 +15,7 @@ use crate::proto::device_path::{ self, DevicePathHeader, DevicePathNode, DeviceSubType, DeviceType, NodeConversionError, }; use crate::proto::network::IpAddress; -use crate::{guid, Guid}; +use crate::{Guid, guid}; use bitflags::bitflags; use core::mem::{size_of, size_of_val}; use core::ptr::addr_of; @@ -3647,10 +3647,10 @@ impl TryFrom<&DevicePathNode> for DevicePathNodeEnum<'_> { /// Build device paths from their component nodes. pub mod build { use super::*; + use crate::CStr16; use crate::proto::device_path::build::{BuildError, BuildNode}; use crate::proto::device_path::{DeviceSubType, DeviceType}; - use crate::CStr16; - use core::mem::{size_of_val, MaybeUninit}; + use core::mem::{MaybeUninit, size_of_val}; /// Device path build nodes for [`DeviceType::END`]. pub mod end { use super::*; diff --git a/xtask/src/device_path/mod.rs b/xtask/src/device_path/mod.rs index caffa2f0..821a705b 100644 --- a/xtask/src/device_path/mod.rs +++ b/xtask/src/device_path/mod.rs @@ -73,7 +73,7 @@ fn gen_uefi_code_as_string(groups: &[NodeGroup]) -> Result { let code = quote!( use bitflags::bitflags; use crate::data_types::UnalignedSlice; - use crate::{guid, Guid}; + use crate::{Guid, guid}; use crate::polyfill::maybe_uninit_slice_as_mut_ptr; use crate::proto::device_path::{ self, DevicePathHeader, DevicePathNode, DeviceSubType, DeviceType,