mirror of
https://github.com/bertptrs/tracing-mutex.git
synced 2025-12-25 20:50:32 +01:00
Simplify lazy mutex ID drop
This commit is contained in:
@@ -53,7 +53,6 @@ use std::marker::PhantomData;
|
|||||||
use std::mem::MaybeUninit;
|
use std::mem::MaybeUninit;
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
use std::ptr;
|
|
||||||
use std::sync::atomic::AtomicUsize;
|
use std::sync::atomic::AtomicUsize;
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
@@ -271,9 +270,7 @@ impl Drop for LazyMutexId {
|
|||||||
// We have a valid mutex ID and need to drop it
|
// We have a valid mutex ID and need to drop it
|
||||||
|
|
||||||
// Safety: we know that this pointer is valid because the initializer has successfully run.
|
// Safety: we know that this pointer is valid because the initializer has successfully run.
|
||||||
let mutex_id = unsafe { ptr::read((*self.inner.get()).as_ptr()) };
|
unsafe { (*self.inner.get()).assume_init_drop() };
|
||||||
|
|
||||||
drop(mutex_id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user