diff --git a/src/backend/drm/common/fallback.rs b/src/backend/drm/common/fallback.rs index 306b7b6..b853001 100644 --- a/src/backend/drm/common/fallback.rs +++ b/src/backend/drm/common/fallback.rs @@ -43,6 +43,7 @@ use wayland_server::Display; /// [`Device`](::backend::drm::Device) Wrapper to assist fallback /// in case initialization of the preferred device type fails. +#[derive(Debug)] pub enum FallbackDevice { /// Variant for successful initialization of the preferred device Preference(D1), @@ -50,22 +51,6 @@ pub enum FallbackDevice { Fallback(D2), } -// Device is a trait, so we have to impl Debug manually -impl fmt::Debug for FallbackDevice { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - FallbackDevice::Preference(d) => f - .debug_struct("FallbackDevice::Preference") - .field("device_id", &d.device_id()) - .finish(), - FallbackDevice::Fallback(d) => f - .debug_struct("FallbackDevice::Preference") - .field("device_id", &d.device_id()) - .finish(), - } - } -} - struct FallbackDeviceHandlerD1( Box> + 'static>, ) @@ -146,6 +131,7 @@ where /// [`Surface`](::backend::drm::Surface) Wrapper to assist fallback /// in case initialization of the preferred device type fails. +#[derive(Debug)] pub enum FallbackSurface { /// Variant for successful initialization of the preferred device Preference(S1), @@ -153,22 +139,6 @@ pub enum FallbackSurface { Fallback(S2), } -// Surface is a trait, so we have to impl Debug manually -impl fmt::Debug for FallbackSurface { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - FallbackSurface::Preference(s) => f - .debug_struct("FallbackDevice::Preference") - .field("crtc", &s.crtc()) - .finish(), - FallbackSurface::Fallback(s) => f - .debug_struct("FallbackDevice::Preference") - .field("crtc", &s.crtc()) - .finish(), - } - } -} - /// Enum uniting two kinds of possible errors. #[derive(Debug, thiserror::Error)] pub enum EitherError { diff --git a/src/backend/libinput/mod.rs b/src/backend/libinput/mod.rs index cf3d31d..6559b08 100644 --- a/src/backend/libinput/mod.rs +++ b/src/backend/libinput/mod.rs @@ -425,28 +425,9 @@ impl From for backend::MouseButtonState { /// Wrapper for types implementing the [`Session`] trait to provide /// a [`libinput::LibinputInterface`] implementation. #[cfg(feature = "backend_session")] +#[derive(Debug)] pub struct LibinputSessionInterface(S); -// Session is a trait, so we have to impl Debug manually -#[cfg(feature = "backend_session")] -impl fmt::Debug for LibinputSessionInterface { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - struct SessionDebug<'a, S: Session>(&'a S); - impl<'a, S: Session> fmt::Debug for SessionDebug<'a, S> { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Session") - .field("is_active", &self.0.is_active()) - .field("seat", &self.0.seat()) - .finish() - } - } - - f.debug_tuple("LibinputSessionInterface") - .field(&SessionDebug(&self.0)) - .finish() - } -} - #[cfg(feature = "backend_session")] impl From for LibinputSessionInterface { fn from(session: S) -> LibinputSessionInterface {