diff --git a/input-capture/src/error.rs b/input-capture/src/error.rs index e174c72..9264beb 100644 --- a/input-capture/src/error.rs +++ b/input-capture/src/error.rs @@ -73,12 +73,12 @@ pub enum CaptureCreationError { impl CaptureCreationError { /// request was intentionally denied by the user pub(crate) fn cancelled_by_user(&self) -> bool { - match self { - CaptureCreationError::Libei(LibeiCaptureCreationError::Ashpd( - ashpd::Error::Response(ResponseError::Cancelled), - )) => true, - _ => false, - } + matches!( + self, + CaptureCreationError::Libei(LibeiCaptureCreationError::Ashpd(ashpd::Error::Response( + ResponseError::Cancelled + ))) + ) } } diff --git a/input-capture/src/libei.rs b/input-capture/src/libei.rs index 6f3b4f9..67c0c17 100644 --- a/input-capture/src/libei.rs +++ b/input-capture/src/libei.rs @@ -290,8 +290,7 @@ async fn do_capture<'a>( &mut active_clients, &mut next_barrier_id, ¬ify_release, - cancel_session.clone(), - cancel_update.clone(), + (cancel_session.clone(), cancel_update.clone()), ); let (capture_result, ()) = tokio::join!(capture_session, handle_session_update_request); @@ -334,9 +333,9 @@ async fn do_capture_session( active_clients: &mut Vec<(CaptureHandle, Position)>, next_barrier_id: &mut u32, notify_release: &Notify, - cancel_session: CancellationToken, - cancel_update: CancellationToken, + cancel: (CancellationToken, CancellationToken), ) -> Result<(), CaptureError> { + let (cancel_session, cancel_update) = cancel; // current client let current_client = Rc::new(Cell::new(None)); diff --git a/input-emulation/src/error.rs b/input-emulation/src/error.rs index cbf64d5..368a49e 100644 --- a/input-emulation/src/error.rs +++ b/input-emulation/src/error.rs @@ -79,15 +79,14 @@ pub enum EmulationCreationError { impl EmulationCreationError { /// request was intentionally denied by the user pub(crate) fn cancelled_by_user(&self) -> bool { - match self { + matches!( + self, EmulationCreationError::Libei(LibeiEmulationCreationError::Ashpd(Response( ResponseError::Cancelled, - ))) - | EmulationCreationError::Xdp(XdpEmulationCreationError::Ashpd(Response( + ))) | EmulationCreationError::Xdp(XdpEmulationCreationError::Ashpd(Response( ResponseError::Cancelled, - ))) => true, - _ => false, - } + ))) + ) } }