Merge #1285
1285: Add must_use to OnDrop r=Dirbaio a=rmja Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
This commit is contained in:
commit
4bfe624893
@ -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