Add must_use to OnDrop

This commit is contained in:
Rasmus Melchior Jacobsen 2023-03-17 11:40:19 +01:00 committed by GitHub
parent f9c0c53e12
commit 7be385dbb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
use core::mem;
use core::mem::MaybeUninit;
#[must_use = "to delay the drop handler invokation to the end of the scope"]
pub struct OnDrop<F: FnOnce()> {
f: MaybeUninit<F>,
}
@ -27,6 +28,7 @@ impl<F: FnOnce()> Drop for OnDrop<F> {
///
/// To correctly dispose of this device, call the [defuse](struct.DropBomb.html#method.defuse)
/// method before this object is dropped.
#[must_use = "to delay the drop bomb invokation to the end of the scope"]
pub struct DropBomb {
_private: (),
}