From afcdd3579a647b0adf372002e6725a895058b3a9 Mon Sep 17 00:00:00 2001 From: DataTriny Date: Thu, 26 Oct 2023 20:31:18 +0200 Subject: [PATCH] Replace an unnecessary Arc by an Rc --- platforms/windows/src/tests/mod.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/platforms/windows/src/tests/mod.rs b/platforms/windows/src/tests/mod.rs index 8fbd4140..0b1f7f8c 100644 --- a/platforms/windows/src/tests/mod.rs +++ b/platforms/windows/src/tests/mod.rs @@ -8,7 +8,7 @@ use once_cell::{sync::Lazy as SyncLazy, unsync::Lazy}; use std::{ cell::RefCell, rc::Rc, - sync::{Arc, Condvar, Mutex}, + sync::{Condvar, Mutex}, thread, time::Duration, }; @@ -267,12 +267,9 @@ pub(crate) struct ReceivedFocusEvent { cv: Condvar, } -unsafe impl Send for ReceivedFocusEvent {} -unsafe impl Sync for ReceivedFocusEvent {} - impl ReceivedFocusEvent { - fn new() -> Arc { - Arc::new(Self { + fn new() -> Rc { + Rc::new(Self { mutex: Mutex::new(None), cv: Condvar::new(), }) @@ -304,14 +301,14 @@ impl ReceivedFocusEvent { #[implement(Windows::Win32::UI::Accessibility::IUIAutomationFocusChangedEventHandler)] pub(crate) struct FocusEventHandler { - received: Arc, + received: Rc, } impl FocusEventHandler { #[allow(clippy::new_ret_no_self)] // it does return self, but wrapped pub(crate) fn new() -> ( IUIAutomationFocusChangedEventHandler, - Arc, + Rc, ) { let received = ReceivedFocusEvent::new(); (