Skip to content

Commit

Permalink
Fix warning about unused value by explicitly dropping box
Browse files Browse the repository at this point in the history
  • Loading branch information
Imberflur committed Sep 16, 2023
1 parent 32230cc commit f83f215
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/atomic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl Drop for OnceAtom {
if !ptr.is_null() {
// SAFETY: If the pointer is not null, we created it from
// `Box::into_raw` in `Self::atom_get_or_init`.
unsafe { Box::from_raw(ptr) };
drop(unsafe { Box::from_raw(ptr) });
}
}
}
Expand Down Expand Up @@ -240,7 +240,7 @@ impl OnceAtom {
) {
// SAFETY: We obtained this pointer from `Box::into_raw` above
// and failed to publish it to the `AtomicPtr`.
unsafe { Box::from_raw(new_ptr) };
drop(unsafe { Box::from_raw(new_ptr) });
existing_ptr
} else {
new_ptr
Expand Down

0 comments on commit f83f215

Please sign in to comment.