Skip to content

Commit

Permalink
Replace an unnecessary Arc by an Rc
Browse files Browse the repository at this point in the history
  • Loading branch information
DataTriny committed Oct 26, 2023
1 parent 0289eb4 commit afcdd35
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions platforms/windows/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -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<Self> {
Arc::new(Self {
fn new() -> Rc<Self> {
Rc::new(Self {
mutex: Mutex::new(None),
cv: Condvar::new(),
})
Expand Down Expand Up @@ -304,14 +301,14 @@ impl ReceivedFocusEvent {

#[implement(Windows::Win32::UI::Accessibility::IUIAutomationFocusChangedEventHandler)]
pub(crate) struct FocusEventHandler {
received: Arc<ReceivedFocusEvent>,
received: Rc<ReceivedFocusEvent>,
}

impl FocusEventHandler {
#[allow(clippy::new_ret_no_self)] // it does return self, but wrapped
pub(crate) fn new() -> (
IUIAutomationFocusChangedEventHandler,
Arc<ReceivedFocusEvent>,
Rc<ReceivedFocusEvent>,
) {
let received = ReceivedFocusEvent::new();
(
Expand Down

0 comments on commit afcdd35

Please sign in to comment.