Skip to content

Commit d37b8cf

Browse files
author
chansuke
committed
Remove unnecessary unsafe block from condvar_atomics & mutex_atomics
1 parent d147f78 commit d37b8cf

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

library/std/src/sys/wasm/condvar_atomics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ impl Condvar {
5353
#[inline]
5454
pub unsafe fn notify_all(&self) {
5555
self.cnt.fetch_add(1, SeqCst);
56-
// SAFETY: memory_atomic_notify()is always valid
56+
// SAFETY: ptr() is always valid
5757
unsafe {
5858
wasm32::memory_atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone"
5959
}

library/std/src/sys/wasm/mutex_atomics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl Mutex {
5050

5151
#[inline]
5252
pub unsafe fn try_lock(&self) -> bool {
53-
unsafe { self.locked.compare_exchange(0, 1, SeqCst, SeqCst).is_ok() }
53+
self.locked.compare_exchange(0, 1, SeqCst, SeqCst).is_ok()
5454
}
5555

5656
#[inline]
@@ -86,7 +86,7 @@ unsafe impl Sync for ReentrantMutex {}
8686

8787
impl ReentrantMutex {
8888
pub const unsafe fn uninitialized() -> ReentrantMutex {
89-
unsafe { ReentrantMutex { owner: AtomicU32::new(0), recursions: UnsafeCell::new(0) } }
89+
ReentrantMutex { owner: AtomicU32::new(0), recursions: UnsafeCell::new(0) }
9090
}
9191

9292
pub unsafe fn init(&self) {

0 commit comments

Comments
 (0)