New clippy fixes

This commit is contained in:
Victor Berger 2020-11-02 10:03:33 +01:00 committed by Victor Berger
parent 8fde779806
commit 36e11284c2
5 changed files with 21 additions and 30 deletions

View File

@ -48,11 +48,7 @@ impl AnvilState {
action = process_keyboard_shortcut(*modifiers, keysym); action = process_keyboard_shortcut(*modifiers, keysym);
// forward to client only if action == KeyAction::Forward // forward to client only if action == KeyAction::Forward
// both for pressed and released, to avoid inconsistencies // both for pressed and released, to avoid inconsistencies
if let KeyAction::Forward = action { matches!(action, KeyAction::Forward)
true
} else {
false
}
}); });
if let KeyState::Released = state { if let KeyState::Released = state {
// only process special actions on key press, not release // only process special actions on key press, not release

View File

@ -675,24 +675,20 @@ impl DrmRenderer {
if let Err(err) = frame.finish() { if let Err(err) = frame.finish() {
warn!(self.logger, "Error during rendering: {:?}", err); warn!(self.logger, "Error during rendering: {:?}", err);
let reschedule = match err { let reschedule =
SwapBuffersError::AlreadySwapped => false, match err {
SwapBuffersError::TemporaryFailure(err) => { SwapBuffersError::AlreadySwapped => false,
match err.downcast_ref::<smithay::backend::drm::common::Error>() { SwapBuffersError::TemporaryFailure(err) => {
Some(&smithay::backend::drm::common::Error::DeviceInactive) => false, match err.downcast_ref::<smithay::backend::drm::common::Error>() {
Some(&smithay::backend::drm::common::Error::Access { ref source, .. }) Some(&smithay::backend::drm::common::Error::DeviceInactive) => false,
if match source.get_ref() { Some(&smithay::backend::drm::common::Error::Access {
drm::SystemError::PermissionDenied => true, ref source, ..
_ => false, }) if matches!(source.get_ref(), drm::SystemError::PermissionDenied) => false,
} => _ => true,
{
false
} }
_ => true,
} }
} SwapBuffersError::ContextLost(err) => panic!("Rendering loop lost: {}", err),
SwapBuffersError::ContextLost(err) => panic!("Rendering loop lost: {}", err), };
};
if reschedule { if reschedule {
debug!(self.logger, "Rescheduling"); debug!(self.logger, "Rescheduling");

View File

@ -2,6 +2,9 @@
//! Types to make fallback device initialization easier //! 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")] #[cfg(feature = "backend_drm_egl")]
use crate::backend::drm::egl::{Arguments as EglDeviceArguments, EglDevice, Error as EglDeviceError}; use crate::backend::drm::egl::{Arguments as EglDeviceArguments, EglDevice, Error as EglDeviceError};
#[cfg(all(feature = "backend_drm_atomic", feature = "backend_drm_legacy"))] #[cfg(all(feature = "backend_drm_atomic", feature = "backend_drm_legacy"))]

View File

@ -103,11 +103,10 @@ impl<N: native::NativeSurface> EGLSurface<N> {
}; };
// workaround for missing `PartialEq` impl // workaround for missing `PartialEq` impl
let is_bad_surface = if let Err(SwapBuffersError::EGLSwapBuffers(EGLError::BadSurface)) = result { let is_bad_surface = matches!(
true result,
} else { Err(SwapBuffersError::EGLSwapBuffers(EGLError::BadSurface))
false );
};
if self.native.needs_recreation() || surface.is_null() || is_bad_surface { if self.native.needs_recreation() || surface.is_null() || is_bad_surface {
let previous = self.surface.compare_and_swap( let previous = self.surface.compare_and_swap(

View File

@ -160,10 +160,7 @@ impl PointerHandle {
/// Check if this pointer is currently being grabbed /// Check if this pointer is currently being grabbed
pub fn is_grabbed(&self) -> bool { pub fn is_grabbed(&self) -> bool {
let guard = self.inner.borrow_mut(); let guard = self.inner.borrow_mut();
match guard.grab { !matches!(guard.grab, GrabStatus::None)
GrabStatus::None => false,
_ => true,
}
} }
/// Returns the start data for the grab, if any. /// Returns the start data for the grab, if any.