diff options
| author | Rasmus Melchior Jacobsen <[email protected]> | 2023-03-17 11:40:19 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-03-17 11:40:19 +0100 |
| commit | 7be385dbb182a2bdafa286e4eb214bfea0190342 (patch) | |
| tree | cc82cace30a1c25f28cb225b7f96ae0adbb6f0a4 /embassy-hal-common | |
| parent | f9c0c53e126e845f202d56f9402b61c45b05c87a (diff) | |
Add must_use to OnDrop
Diffstat (limited to 'embassy-hal-common')
| -rw-r--r-- | embassy-hal-common/src/drop.rs | 2 |
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 @@ | |||
| 1 | use core::mem; | 1 | use core::mem; |
| 2 | use core::mem::MaybeUninit; | 2 | use core::mem::MaybeUninit; |
| 3 | 3 | ||
| 4 | #[must_use = "to delay the drop handler invokation to the end of the scope"] | ||
| 4 | pub struct OnDrop<F: FnOnce()> { | 5 | pub 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"] | ||
| 30 | pub struct DropBomb { | 32 | pub struct DropBomb { |
| 31 | _private: (), | 33 | _private: (), |
| 32 | } | 34 | } |
