From 014faf951425a74ee346d6bb75a084debf749ba7 Mon Sep 17 00:00:00 2001 From: Kaur Kuut Date: Fri, 23 Feb 2024 17:43:23 +0200 Subject: [PATCH] Fix some Linux Clippy issues. --- druid-shell/src/backend/shared/xkb/mod.rs | 3 +-- druid-shell/src/backend/wayland/application.rs | 2 +- druid-shell/src/backend/wayland/mod.rs | 3 +++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/druid-shell/src/backend/shared/xkb/mod.rs b/druid-shell/src/backend/shared/xkb/mod.rs index 511ff9b500..e4cf233735 100644 --- a/druid-shell/src/backend/shared/xkb/mod.rs +++ b/druid-shell/src/backend/shared/xkb/mod.rs @@ -270,8 +270,7 @@ impl State { } // add 1 because we will get a null-terminated string. let len = usize::try_from(len).unwrap() + 1; - let mut buf: Vec = Vec::new(); - buf.resize(len, 0); + let mut buf: Vec = vec![0; len]; xkb_state_key_get_utf8(self.state, scancode, buf.as_mut_ptr() as *mut c_char, len); assert!(buf[buf.len() - 1] == 0); buf.pop(); diff --git a/druid-shell/src/backend/wayland/application.rs b/druid-shell/src/backend/wayland/application.rs index 2a3ac27191..fdb743c254 100644 --- a/druid-shell/src/backend/wayland/application.rs +++ b/druid-shell/src/backend/wayland/application.rs @@ -462,7 +462,7 @@ impl Data { fn current_window_id(&self) -> u64 { static DEFAULT: u64 = 0_u64; - *self.active_surface_id.borrow().get(0).unwrap_or(&DEFAULT) + *self.active_surface_id.borrow().front().unwrap_or(&DEFAULT) } pub(super) fn acquire_current_window(&self) -> Option { diff --git a/druid-shell/src/backend/wayland/mod.rs b/druid-shell/src/backend/wayland/mod.rs index 736cc4b608..9af3b48d37 100644 --- a/druid-shell/src/backend/wayland/mod.rs +++ b/druid-shell/src/backend/wayland/mod.rs @@ -14,6 +14,9 @@ //! wayland platform support +// TODO: Remove this and fix the non-Send/Sync Arc issues +#![allow(clippy::arc_with_non_send_sync)] + pub mod application; pub mod clipboard; mod display;