From 8ad6bb968e0b4242cf74231dbe58f2da80c7b716 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Fri, 1 Jul 2022 23:55:14 +0300 Subject: [PATCH] Satisfy clippy 1.62 (#2215) --- druid-shell/src/backend/gtk/window.rs | 4 ++-- druid-shell/src/backend/wayland/pointers.rs | 2 +- druid-shell/src/backend/windows/menu.rs | 4 +++- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/druid-shell/src/backend/gtk/window.rs b/druid-shell/src/backend/gtk/window.rs index 0d08f782fb..c00bf87b69 100644 --- a/druid-shell/src/backend/gtk/window.rs +++ b/druid-shell/src/backend/gtk/window.rs @@ -76,11 +76,11 @@ const SCALE_TARGET_DPI: f64 = 96.0; /// Taken from /// It is used to reduce the boilerplate of setting up gtk callbacks /// Example: -/// ``` +/// ```ignore /// button.connect_clicked(clone!(handle => move |_| { ... })) /// ``` /// is equivalent to: -/// ``` +/// ```ignore /// { /// let handle = handle.clone(); /// button.connect_clicked(move |_| { ... }) diff --git a/druid-shell/src/backend/wayland/pointers.rs b/druid-shell/src/backend/wayland/pointers.rs index b6d25fc583..bb6701e38b 100644 --- a/druid-shell/src/backend/wayland/pointers.rs +++ b/druid-shell/src/backend/wayland/pointers.rs @@ -333,7 +333,7 @@ impl Pointer { )) } ButtonState::Released => { - let mut updated = self.buttons.borrow_mut().remove(button); + self.buttons.borrow_mut().remove(button); self.clickevent.borrow_mut().debounce(MouseEvtKind::Up( mouse::MouseEvent { pos: self.pos.get(), diff --git a/druid-shell/src/backend/windows/menu.rs b/druid-shell/src/backend/windows/menu.rs index d4ed0674f5..b3f1c92e09 100644 --- a/druid-shell/src/backend/windows/menu.rs +++ b/druid-shell/src/backend/windows/menu.rs @@ -15,6 +15,7 @@ //! Safe wrapper for menus. use std::collections::HashMap; +use std::fmt::Write as _; use std::mem; use std::ptr::null; @@ -219,6 +220,7 @@ fn format_hotkey(key: &HotKey, s: &mut String) { KbKey::ArrowRight => s.push_str("Right"), KbKey::ArrowUp => s.push_str("Up"), KbKey::ArrowDown => s.push_str("Down"), - _ => s.push_str(&format!("{:?}", key.key)), + _ => write!(s, "{}", key.key) + .unwrap_or_else(|err| tracing::warn!("Failed to convert hotkey to string: {}", err)), } }