Skip to content

Commit fcdc6fe

Browse files
uefi: Fix unused-unsafe warning depending on enabled features
If neither the logger nor global_allocator features is enabled, the unsafe block here would generated a warning because there was no code in it. Split into two blocks and gate the blocks behind cfgs to solve this.
1 parent 2e4b232 commit fcdc6fe

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

uefi/src/helpers/mod.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,15 @@ pub fn init(st: &mut SystemTable<Boot>) -> Result<()> {
8383
// Setup the system table singleton
8484
SYSTEM_TABLE.store(st.as_ptr().cast_mut(), Ordering::Release);
8585

86-
unsafe {
87-
// Setup logging and memory allocation
86+
// Setup logging and memory allocation
8887

89-
#[cfg(feature = "logger")]
88+
#[cfg(feature = "logger")]
89+
unsafe {
9090
logger::init(st);
91+
}
9192

92-
#[cfg(feature = "global_allocator")]
93+
#[cfg(feature = "global_allocator")]
94+
unsafe {
9395
uefi::allocator::init(st);
9496
}
9597

0 commit comments

Comments
 (0)