From 2e4b232295ce1f19d50d7e6d378534cb3339f2b0 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sun, 14 Apr 2024 21:25:49 -0400 Subject: [PATCH 1/3] uefi: Remove an unused variable --- uefi/src/table/boot.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/uefi/src/table/boot.rs b/uefi/src/table/boot.rs index ea6b1e63f..6dbfb0bd1 100644 --- a/uefi/src/table/boot.rs +++ b/uefi/src/table/boot.rs @@ -1949,8 +1949,6 @@ mod tests { use super::{MemoryDescriptor, MemoryMapIter}; fn buffer_to_map(buffer: &mut [MemoryDescriptor]) -> MemoryMap { - let desc_count = buffer.len(); - let byte_buffer = { unsafe { core::slice::from_raw_parts_mut(buffer.as_mut_ptr() as *mut u8, size_of_val(buffer)) From fcdc6feeb7d4205f83774e5050e8a4c583a9c412 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sun, 14 Apr 2024 21:26:11 -0400 Subject: [PATCH 2/3] 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. --- uefi/src/helpers/mod.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/uefi/src/helpers/mod.rs b/uefi/src/helpers/mod.rs index 0f31f765a..0a757b615 100644 --- a/uefi/src/helpers/mod.rs +++ b/uefi/src/helpers/mod.rs @@ -83,13 +83,15 @@ pub fn init(st: &mut SystemTable) -> Result<()> { // Setup the system table singleton SYSTEM_TABLE.store(st.as_ptr().cast_mut(), Ordering::Release); - unsafe { - // Setup logging and memory allocation + // Setup logging and memory allocation - #[cfg(feature = "logger")] + #[cfg(feature = "logger")] + unsafe { logger::init(st); + } - #[cfg(feature = "global_allocator")] + #[cfg(feature = "global_allocator")] + unsafe { uefi::allocator::init(st); } From 02baa0fdbe3a24a3efae0d0d96f91b071dbee1f6 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Sun, 14 Apr 2024 22:00:00 -0400 Subject: [PATCH 3/3] ci: Treat warnings as errors for all CI jobs --- .github/workflows/rust.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 667eea9cd..5436a4086 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,6 +11,8 @@ on: - version-* schedule: - cron: '0 0 * * 0-6' +env: + RUSTFLAGS: -D warnings jobs: test_aarch64: name: Integration Test (AArch64)