From 496bc653c9152a9bbd3a04f889e970bec6ea13de Mon Sep 17 00:00:00 2001 From: "Sergey V. Galtsev" Date: Sun, 1 May 2022 19:14:12 +0300 Subject: [PATCH] Warn if the guard is not assigned to a variable and is dropped immediately instead of at the scope's end. --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index bbab2bb..b5522c7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -322,6 +322,7 @@ where /// /// The `Strategy` decides whether the scope guard's closure should run. #[inline] + #[must_use] pub fn with_strategy(v: T, dropfn: F) -> ScopeGuard { ScopeGuard { value: ManuallyDrop::new(v),