diff options
| author | chansuke <chansuke@georepublic.de> | 2020-10-24 18:22:18 +0900 | 
|---|---|---|
| committer | chansuke <chansuke@georepublic.de> | 2020-10-24 18:22:18 +0900 | 
| commit | d37b8cf729187e5dcabb3650031eb806d1f79770 (patch) | |
| tree | 9dcf548014f0a6f0f3c6a2072b1460376b2c22d1 | |
| parent | d147f78e367386bf63ccb03d453e151e37cfdd81 (diff) | |
| download | rust-d37b8cf729187e5dcabb3650031eb806d1f79770.tar.gz rust-d37b8cf729187e5dcabb3650031eb806d1f79770.zip  | |
Remove unnecessary unsafe block from condvar_atomics & mutex_atomics
| -rw-r--r-- | library/std/src/sys/wasm/condvar_atomics.rs | 2 | ||||
| -rw-r--r-- | library/std/src/sys/wasm/mutex_atomics.rs | 4 | 
2 files changed, 3 insertions, 3 deletions
diff --git a/library/std/src/sys/wasm/condvar_atomics.rs b/library/std/src/sys/wasm/condvar_atomics.rs index c2c47910582..0c1c076cc91 100644 --- a/library/std/src/sys/wasm/condvar_atomics.rs +++ b/library/std/src/sys/wasm/condvar_atomics.rs @@ -53,7 +53,7 @@ impl Condvar { #[inline] pub unsafe fn notify_all(&self) { self.cnt.fetch_add(1, SeqCst); - // SAFETY: memory_atomic_notify()is always valid + // SAFETY: ptr() is always valid unsafe { wasm32::memory_atomic_notify(self.ptr(), u32::MAX); // -1 == "wake everyone" } diff --git a/library/std/src/sys/wasm/mutex_atomics.rs b/library/std/src/sys/wasm/mutex_atomics.rs index 11d7f4c389d..479182ffa44 100644 --- a/library/std/src/sys/wasm/mutex_atomics.rs +++ b/library/std/src/sys/wasm/mutex_atomics.rs @@ -50,7 +50,7 @@ impl Mutex { #[inline] pub unsafe fn try_lock(&self) -> bool { - unsafe { self.locked.compare_exchange(0, 1, SeqCst, SeqCst).is_ok() } + self.locked.compare_exchange(0, 1, SeqCst, SeqCst).is_ok() } #[inline] @@ -86,7 +86,7 @@ unsafe impl Sync for ReentrantMutex {} impl ReentrantMutex { pub const unsafe fn uninitialized() -> ReentrantMutex { - unsafe { ReentrantMutex { owner: AtomicU32::new(0), recursions: UnsafeCell::new(0) } } + ReentrantMutex { owner: AtomicU32::new(0), recursions: UnsafeCell::new(0) } } pub unsafe fn init(&self) {  | 
