Skip to content

Commit

Permalink
Warn if the guard is not assigned to a variable and is dropped immedi…
Browse files Browse the repository at this point in the history
…ately instead of at the scope's end.
  • Loading branch information
sergey-v-galtsev committed May 1, 2022
1 parent 2eeec4a commit 496bc65
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T, F, S> {
ScopeGuard {
value: ManuallyDrop::new(v),
Expand Down

0 comments on commit 496bc65

Please sign in to comment.