From da5c81455582449d65ae58081637c3f3a0aa2721 Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Wed, 23 Jun 2021 22:52:49 +0200 Subject: [PATCH] Clippy fixes --- anvil/src/window_map.rs | 23 ++++++++++------------- src/backend/drm/surface/atomic.rs | 1 + src/backend/drm/surface/gbm.rs | 2 +- src/backend/egl/mod.rs | 4 ++++ 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/anvil/src/window_map.rs b/anvil/src/window_map.rs index 07d46ed..3e2fa7f 100644 --- a/anvil/src/window_map.rs +++ b/anvil/src/window_map.rs @@ -56,21 +56,18 @@ impl Kind { /// Activate/Deactivate this window pub fn set_activated(&self, active: bool) { - match *self { - Kind::Xdg(ref t) => { - let changed = t.with_pending_state(|state| { - if active { - state.states.set(xdg_toplevel::State::Activated) - } else { - state.states.unset(xdg_toplevel::State::Activated) - } - }); - if let Ok(true) = changed { - t.send_configure(); + if let Kind::Xdg(ref t) = self { + let changed = t.with_pending_state(|state| { + if active { + state.states.set(xdg_toplevel::State::Activated) + } else { + state.states.unset(xdg_toplevel::State::Activated) } + }); + if let Ok(true) = changed { + t.send_configure(); } - _ => {} - }; + } } } diff --git a/src/backend/drm/surface/atomic.rs b/src/backend/drm/surface/atomic.rs index 56891de..c3214e4 100644 --- a/src/backend/drm/surface/atomic.rs +++ b/src/backend/drm/surface/atomic.rs @@ -752,6 +752,7 @@ impl AtomicDrmSurface { } // If a mode is set a matching blob needs to be set (the inverse is not true) + #[allow(clippy::too_many_arguments)] pub fn build_request<'a>( &self, new_connectors: &mut dyn Iterator, diff --git a/src/backend/drm/surface/gbm.rs b/src/backend/drm/surface/gbm.rs index 6fba691..eb780be 100644 --- a/src/backend/drm/surface/gbm.rs +++ b/src/backend/drm/surface/gbm.rs @@ -313,7 +313,7 @@ where let maybe_buffer = slot.userdata().as_ref().map(|(buf, _)| buf.clone()); let dmabuf = match maybe_buffer { - Some(buf) => buf.clone(), + Some(buf) => buf, None => { let dmabuf = slot.export()?; let fb_handle = attach_framebuffer(&self.drm, &*slot)?; diff --git a/src/backend/egl/mod.rs b/src/backend/egl/mod.rs index d84185b..2cd26b3 100644 --- a/src/backend/egl/mod.rs +++ b/src/backend/egl/mod.rs @@ -70,6 +70,10 @@ impl ::std::error::Error for EglExtensionNotSupportedError {} /// Returns the address of an OpenGL function. /// /// Result is independent of displays and does not guarantee an extension is actually supported at runtime. +/// +/// # Safety +/// +/// This function should only be invoked while an EGL context is active. pub unsafe fn get_proc_address(symbol: &str) -> *const c_void { let addr = CString::new(symbol.as_bytes()).unwrap(); let addr = addr.as_ptr();