Skip to content

Commit 2e5f897

Browse files
committed
Import ManuallyDrop in function
1 parent 3050354 commit 2e5f897

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/hl/object.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub mod tests {
136136

137137
#[test]
138138
pub fn test_incref_decref_drop() {
139+
use std::mem::ManuallyDrop;
139140
let mut obj = TestObject::from_id(h5call!(H5Pcreate(*H5P_FILE_ACCESS)).unwrap()).unwrap();
140141
let obj_id = obj.id();
141142
obj = TestObject::from_id(h5call!(H5Pcreate(*H5P_FILE_ACCESS)).unwrap()).unwrap();
@@ -157,12 +158,12 @@ pub mod tests {
157158

158159
// obj is already owned, we must ensure we do not call drop on this without
159160
// an incref
160-
let mut obj2 = std::mem::ManuallyDrop::new(TestObject::from_id(obj.id()).unwrap());
161+
let mut obj2 = ManuallyDrop::new(TestObject::from_id(obj.id()).unwrap());
161162
assert_eq!(obj.refcount(), 1);
162163

163164
obj2.incref();
164165
// We can now take, as we have exactly two handles
165-
let obj2 = unsafe { std::mem::ManuallyDrop::take(&mut obj2) };
166+
let obj2 = unsafe { ManuallyDrop::take(&mut obj2) };
166167

167168
h5lock!({
168169
// We must hold a lock here to prevent another thread creating an object

0 commit comments

Comments
 (0)