aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-03-17 14:38:19 +0000
committerGitHub <[email protected]>2023-03-17 14:38:19 +0000
commit4bfe6248936bf9d12185ada7f43c938d87f99841 (patch)
treecc82cace30a1c25f28cb225b7f96ae0adbb6f0a4
parentf9c0c53e126e845f202d56f9402b61c45b05c87a (diff)
parent7be385dbb182a2bdafa286e4eb214bfea0190342 (diff)
Merge #1285
1285: Add must_use to OnDrop r=Dirbaio a=rmja Co-authored-by: Rasmus Melchior Jacobsen <[email protected]>
-rw-r--r--embassy-hal-common/src/drop.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/embassy-hal-common/src/drop.rs b/embassy-hal-common/src/drop.rs
index 6ef716f99..7cd16aaec 100644
--- a/embassy-hal-common/src/drop.rs
+++ b/embassy-hal-common/src/drop.rs
@@ -1,6 +1,7 @@
1use core::mem; 1use core::mem;
2use core::mem::MaybeUninit; 2use core::mem::MaybeUninit;
3 3
4#[must_use = "to delay the drop handler invokation to the end of the scope"]
4pub struct OnDrop<F: FnOnce()> { 5pub struct OnDrop<F: FnOnce()> {
5 f: MaybeUninit<F>, 6 f: MaybeUninit<F>,
6} 7}
@@ -27,6 +28,7 @@ impl<F: FnOnce()> Drop for OnDrop<F> {
27/// 28///
28/// To correctly dispose of this device, call the [defuse](struct.DropBomb.html#method.defuse) 29/// To correctly dispose of this device, call the [defuse](struct.DropBomb.html#method.defuse)
29/// method before this object is dropped. 30/// method before this object is dropped.
31#[must_use = "to delay the drop bomb invokation to the end of the scope"]
30pub struct DropBomb { 32pub struct DropBomb {
31 _private: (), 33 _private: (),
32} 34}