From 9b528505939878dd198706dfdbd5e1bd545bf11d Mon Sep 17 00:00:00 2001 From: Gabriel Majeri Date: Sat, 18 Dec 2021 22:11:58 +0200 Subject: [PATCH 1/2] Add missing `#[must_use]` marker attributes --- src/data_types/mod.rs | 1 + src/table/system.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/data_types/mod.rs b/src/data_types/mod.rs index dd7f35695..91834e3c3 100644 --- a/src/data_types/mod.rs +++ b/src/data_types/mod.rs @@ -22,6 +22,7 @@ impl Event { /// When an event is closed by calling `BootServices::close_event`, that event and ALL references /// to it are invalidated and the underlying memory is freed by firmware. The caller must ensure /// that any clones of a closed `Event` are never used again. + #[must_use] pub unsafe fn unsafe_clone(&self) -> Self { Self(self.0) } diff --git a/src/table/system.rs b/src/table/system.rs index 985f1d7ee..9df408f87 100644 --- a/src/table/system.rs +++ b/src/table/system.rs @@ -191,6 +191,7 @@ impl SystemTable { /// used after boot services are exited. However, the singleton-based /// designs that Rust uses for memory allocation, logging, and panic /// handling require taking this risk. + #[must_use] pub unsafe fn unsafe_clone(&self) -> Self { SystemTable { table: self.table, From 54e7f4ce019c51bcee4ac9a8065275ab816d0577 Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Tue, 21 Dec 2021 14:11:35 -0500 Subject: [PATCH 2/2] Temporarily allow clippy::return_self_not_must_use Filed https://github.com/rust-osdev/uefi-rs/issues/333 to remind us to revert it later. --- src/result/completion.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/result/completion.rs b/src/result/completion.rs index 39b538225..bfe5e00d4 100644 --- a/src/result/completion.rs +++ b/src/result/completion.rs @@ -1,3 +1,7 @@ +// TODO: workaround for +// https://github.com/rust-lang/rust-clippy/issues/8140 +#![allow(clippy::return_self_not_must_use)] + use super::Status; use log::warn;