Skip to content

Commit 80252b4

Browse files
committed
fix: Use explicitly std::mem::drop to free memory
It fix lint "non-binding `let` on a type that implements `Drop`"
1 parent 29029b6 commit 80252b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub fn raw<T>(data: T) -> *mut T {
5555
///
5656
/// Invalid pointer or call it twice could cause an undefined behavior or heap error and a crash.
5757
pub unsafe fn free<T>(pointer: *mut T) {
58-
let _ = own_back(pointer); // Ignore the must use lint as previous behavior was ignore null pointers
58+
std::mem::drop(own_back(pointer));
5959
}
6060

6161
/// Opposite of [`raw<T>()`], to use Rust's ownership as usually.

0 commit comments

Comments
 (0)