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);
// 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

View File

@ -675,19 +675,15 @@ impl DrmRenderer {
if let Err(err) = frame.finish() {
warn!(self.logger, "Error during rendering: {:?}", err);
let reschedule = match err {
let reschedule =
match err {
SwapBuffersError::AlreadySwapped => false,
SwapBuffersError::TemporaryFailure(err) => {
match err.downcast_ref::<smithay::backend::drm::common::Error>() {
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
}
Some(&smithay::backend::drm::common::Error::Access {
ref source, ..
}) if matches!(source.get_ref(), drm::SystemError::PermissionDenied) => false,
_ => true,
}
}

View File

@ -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"))]

View File

@ -103,11 +103,10 @@ impl<N: native::NativeSurface> EGLSurface<N> {
};
// 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(

View File

@ -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.