diff --git a/anvil/src/input_handler.rs b/anvil/src/input_handler.rs index bebf4df..6525043 100644 --- a/anvil/src/input_handler.rs +++ b/anvil/src/input_handler.rs @@ -48,11 +48,7 @@ impl AnvilState { action = process_keyboard_shortcut(*modifiers, keysym); // forward to client only if action == KeyAction::Forward // both for pressed and released, to avoid inconsistencies - if let KeyAction::Forward = action { - true - } else { - false - } + matches!(action, KeyAction::Forward) }); if let KeyState::Released = state { // only process special actions on key press, not release diff --git a/anvil/src/udev.rs b/anvil/src/udev.rs index c65b037..e5a8b59 100644 --- a/anvil/src/udev.rs +++ b/anvil/src/udev.rs @@ -675,24 +675,20 @@ impl DrmRenderer { if let Err(err) = frame.finish() { warn!(self.logger, "Error during rendering: {:?}", err); - let reschedule = match err { - SwapBuffersError::AlreadySwapped => false, - SwapBuffersError::TemporaryFailure(err) => { - match err.downcast_ref::() { - Some(&smithay::backend::drm::common::Error::DeviceInactive) => false, - Some(&smithay::backend::drm::common::Error::Access { ref source, .. }) - if match source.get_ref() { - drm::SystemError::PermissionDenied => true, - _ => false, - } => - { - false + let reschedule = + match err { + SwapBuffersError::AlreadySwapped => false, + SwapBuffersError::TemporaryFailure(err) => { + match err.downcast_ref::() { + Some(&smithay::backend::drm::common::Error::DeviceInactive) => false, + Some(&smithay::backend::drm::common::Error::Access { + ref source, .. + }) if matches!(source.get_ref(), drm::SystemError::PermissionDenied) => false, + _ => true, } - _ => true, } - } - SwapBuffersError::ContextLost(err) => panic!("Rendering loop lost: {}", err), - }; + SwapBuffersError::ContextLost(err) => panic!("Rendering loop lost: {}", err), + }; if reschedule { debug!(self.logger, "Rescheduling"); diff --git a/src/backend/drm/common/fallback.rs b/src/backend/drm/common/fallback.rs index bea7378..c9d9f39 100644 --- a/src/backend/drm/common/fallback.rs +++ b/src/backend/drm/common/fallback.rs @@ -2,6 +2,9 @@ //! Types to make fallback device initialization easier //! +// The macros in this module rely on these constructs +#![allow(clippy::needless_arbitrary_self_type)] + #[cfg(feature = "backend_drm_egl")] use crate::backend::drm::egl::{Arguments as EglDeviceArguments, EglDevice, Error as EglDeviceError}; #[cfg(all(feature = "backend_drm_atomic", feature = "backend_drm_legacy"))] diff --git a/src/backend/egl/surface.rs b/src/backend/egl/surface.rs index 163350f..463f95d 100644 --- a/src/backend/egl/surface.rs +++ b/src/backend/egl/surface.rs @@ -103,11 +103,10 @@ impl EGLSurface { }; // workaround for missing `PartialEq` impl - let is_bad_surface = if let Err(SwapBuffersError::EGLSwapBuffers(EGLError::BadSurface)) = result { - true - } else { - false - }; + let is_bad_surface = matches!( + result, + Err(SwapBuffersError::EGLSwapBuffers(EGLError::BadSurface)) + ); if self.native.needs_recreation() || surface.is_null() || is_bad_surface { let previous = self.surface.compare_and_swap( diff --git a/src/wayland/seat/pointer.rs b/src/wayland/seat/pointer.rs index fa697f5..14754b0 100644 --- a/src/wayland/seat/pointer.rs +++ b/src/wayland/seat/pointer.rs @@ -160,10 +160,7 @@ impl PointerHandle { /// Check if this pointer is currently being grabbed pub fn is_grabbed(&self) -> bool { let guard = self.inner.borrow_mut(); - match guard.grab { - GrabStatus::None => false, - _ => true, - } + !matches!(guard.grab, GrabStatus::None) } /// Returns the start data for the grab, if any.