Add must_use to OnDrop
This commit is contained in:
parent
f9c0c53e12
commit
7be385dbb1
@ -1,6 +1,7 @@
|
|||||||
use core::mem;
|
use core::mem;
|
||||||
use core::mem::MaybeUninit;
|
use core::mem::MaybeUninit;
|
||||||
|
|
||||||
|
#[must_use = "to delay the drop handler invokation to the end of the scope"]
|
||||||
pub struct OnDrop<F: FnOnce()> {
|
pub struct OnDrop<F: FnOnce()> {
|
||||||
f: MaybeUninit<F>,
|
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)
|
/// To correctly dispose of this device, call the [defuse](struct.DropBomb.html#method.defuse)
|
||||||
/// method before this object is dropped.
|
/// method before this object is dropped.
|
||||||
|
#[must_use = "to delay the drop bomb invokation to the end of the scope"]
|
||||||
pub struct DropBomb {
|
pub struct DropBomb {
|
||||||
_private: (),
|
_private: (),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user