Add #[must_use] to all guard types

This commit is contained in:
Ruihan Li
2024-06-30 23:46:56 +08:00
committed by Tate, Hongliang Tian
parent 9e4775d9e2
commit 57ecfa2fec
9 changed files with 19 additions and 6 deletions

View File

@ -196,6 +196,8 @@ impl PreemptInfo {
}
/// A guard for disable preempt.
#[clippy::has_significant_drop]
#[must_use]
pub struct DisablePreemptGuard {
// This private field prevents user from constructing values of this type directly.
private: (),
@ -223,7 +225,6 @@ impl Drop for DisablePreemptGuard {
}
/// Disables preemption.
#[must_use]
pub fn disable_preempt() -> DisablePreemptGuard {
DisablePreemptGuard::new()
}