From ba21f86e87a90fec801fa50541994947afe85f24 Mon Sep 17 00:00:00 2001 From: jtroo Date: Fri, 21 Jun 2024 21:30:40 -0700 Subject: [PATCH] chore: clippy --- Cargo.toml | 12 ++++++------ keyberon/src/chord.rs | 9 +++------ parser/Cargo.toml | 2 +- simulated_input/Cargo.toml | 6 +++--- simulated_passthru/Cargo.toml | 6 +++--- src/gui/win_nwg_ext/mod.rs | 1 + src/oskbd/windows/llhook.rs | 18 ++++++++++-------- tcp_protocol/Cargo.toml | 4 ++-- wasm/Cargo.toml | 2 +- windows_key_tester/Cargo.toml | 4 ++-- windows_key_tester/src/windows/llhook.rs | 1 + 11 files changed, 33 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 83d3a0736..6d22f5078 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,18 +38,18 @@ path = "src/main.rs" [dependencies] anyhow = "1" -clap = { version = "4", features = [ "std", "derive", "help", "suggestions" ], default_features = false } +clap = { version = "4", features = [ "std", "derive", "help", "suggestions" ], default-features = false } dirs = "5.0.1" indoc = { version = "2.0.4", optional = true } -instant = { version = "0.1.12", default_features = false } -log = { version = "0.4.8", default_features = false } +instant = { version = "0.1.12", default-features = false } +log = { version = "0.4.8", default-features = false } miette = { version = "5.7.0", features = ["fancy"] } once_cell = "1" parking_lot = "0.12" radix_trie = "0.2" rustc-hash = "1.1.0" simplelog = "0.12.0" -serde_json = { version = "1", features = ["std"], default_features = false, optional = true } +serde_json = { version = "1", features = ["std"], default-features = false, optional = true } time = "0.3.36" # kanata-keyberon = "0.161.0" # kanata-parser = "0.161.0" @@ -68,7 +68,7 @@ open = { version = "5", optional = true } [target.'cfg(target_os = "linux")'.dependencies] signal-hook = "0.3.14" -inotify = { version = "0.10.0", default_features = false } +inotify = { version = "0.10.0", default-features = false } mio = { version = "0.8.11", features = ["os-poll", "os-ext"] } nix = { version = "0.26.1", features = ["ioctl"] } sd-notify = "0.4.1" @@ -101,7 +101,7 @@ windows-sys = { version = "0.52.0", features = [ "Wdk_System", "Wdk_System_SystemServices", ], optional=true } -native-windows-gui = { version = "1.0.13", default_features = false} +native-windows-gui = { version = "1.0.13", default-features = false} regex = { version = "1.10.4", optional = true } kanata-interception = { version = "0.2.0", optional = true } muldiv = { version = "1.0.1", optional = true } diff --git a/keyberon/src/chord.rs b/keyberon/src/chord.rs index 22ccbb106..f3afcf1da 100644 --- a/keyberon/src/chord.rs +++ b/keyberon/src/chord.rs @@ -178,8 +178,7 @@ impl<'a, T> ChordsV2<'a, T> { } pub(crate) fn get_action_chv2(&mut self) -> (QueuedAction<'a, T>, bool) { - match self - .active_chords + self.active_chords .iter_mut() .find_map(|ach| match ach.status { Unread => { @@ -191,10 +190,8 @@ impl<'a, T> ChordsV2<'a, T> { Some((Some(((0, ach.coordinate), ach.delay, ach.action)), true)) } Releasable | Released => None, - }) { - Some(v) => v, - None => (None, false), - } + }) + .unwrap_or_default() } /// Update the times in the queue without activating any chords yet. diff --git a/parser/Cargo.toml b/parser/Cargo.toml index 90f0da739..d002ed8e6 100644 --- a/parser/Cargo.toml +++ b/parser/Cargo.toml @@ -12,7 +12,7 @@ edition = "2021" [dependencies] itertools = "0.12" -log = { version = "0.4.8", default_features = false } +log = { version = "0.4.8", default-features = false } anyhow = "1" parking_lot = "0.12" once_cell = "1" diff --git a/simulated_input/Cargo.toml b/simulated_input/Cargo.toml index 44dbfa5ae..d139d40cb 100644 --- a/simulated_input/Cargo.toml +++ b/simulated_input/Cargo.toml @@ -16,13 +16,13 @@ path = "src/sim.rs" [dependencies] anyhow = "1" -clap = { version = "4", features = [ "std", "derive", "help", "suggestions" ], default_features = false } +clap = { version = "4", features = [ "std", "derive", "help", "suggestions" ], default-features = false } dirs = "5.0.1" -log = { version = "0.4.8", default_features = false } +log = { version = "0.4.8", default-features = false } simplelog = "0.12.0" time = "0.3.36" -kanata = { path = ".." , default_features = false } +kanata = { path = ".." , default-features = false } [features] default = ["simulated_output", "tcp_server"] diff --git a/simulated_passthru/Cargo.toml b/simulated_passthru/Cargo.toml index 5635db56c..e162a7160 100644 --- a/simulated_passthru/Cargo.toml +++ b/simulated_passthru/Cargo.toml @@ -10,11 +10,11 @@ crate-type = ['lib','cdylib'] [dependencies] anyhow = "1" -log = { version = "0.4.8", default_features = false } +log = { version = "0.4.8", default-features = false } parking_lot = "0.12" regex = "1.10.3" -kanata = {path=".." , default_features=false} +kanata = {path=".." , default-features=false} lazy_static = "1.4.0" @@ -25,7 +25,7 @@ winapi = { version = "0.3.9", features = [ "timeapi", "mmsystem", ] } -native-windows-gui = { version = "1.0.12", default_features = false } +native-windows-gui = { version = "1.0.12", default-features = false } kanata-interception = { version = "0.2.0", optional = true } win_dbg_logger = "0.1.0" widestring = "1.1.0" diff --git a/src/gui/win_nwg_ext/mod.rs b/src/gui/win_nwg_ext/mod.rs index d9e4c4345..ffaad3c76 100644 --- a/src/gui/win_nwg_ext/mod.rs +++ b/src/gui/win_nwg_ext/mod.rs @@ -88,6 +88,7 @@ impl BitmapEx for nwg::Bitmap { }; // Ugly hack to set the private `owned` field inside nwg::Bitmap to true + #[allow(clippy::missing_transmute_annotations)] unsafe { std::mem::transmute(bitmap) } } } diff --git a/src/oskbd/windows/llhook.rs b/src/oskbd/windows/llhook.rs index 6efcde086..6340b4cc9 100644 --- a/src/oskbd/windows/llhook.rs +++ b/src/oskbd/windows/llhook.rs @@ -422,14 +422,16 @@ fn mouse_event(flags: u32, data: u32, dx: i32, dy: i32) { let mut input = INPUT { type_: INPUT_MOUSE, u: unsafe { - mem::transmute(MOUSEINPUT { - dx, - dy, - mouseData: data, - dwFlags: flags, - time: 0, - dwExtraInfo: 0, - }) + mem::transmute::( + MOUSEINPUT { + dx, + dy, + mouseData: data, + dwFlags: flags, + time: 0, + dwExtraInfo: 0, + }, + ) }, }; unsafe { SendInput(1, &mut input as LPINPUT, mem::size_of::() as c_int) }; diff --git a/tcp_protocol/Cargo.toml b/tcp_protocol/Cargo.toml index 9054ad47b..aaf9823f5 100644 --- a/tcp_protocol/Cargo.toml +++ b/tcp_protocol/Cargo.toml @@ -6,6 +6,6 @@ description = "TCP protocol for kanata. This does not follow semver." license = "LGPL-3.0-only" [dependencies] -serde = { version = "1", features = ["alloc", "derive"], default_features = false } +serde = { version = "1", features = ["alloc", "derive"], default-features = false } serde_derive = "1.0" -serde_json = { version = "1", features = ["alloc"], default_features = false } +serde_json = { version = "1", features = ["alloc"], default-features = false } diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index fd0178a0b..ab113172a 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -11,7 +11,7 @@ crate-type = [ "cdylib", "rlib" ] [dependencies] wasm-bindgen = "0.2.92" -kanata = { path = ".." , default_features = false, features = [ "simulated_output", "wasm" ] } +kanata = { path = ".." , default-features = false, features = [ "simulated_output", "wasm" ] } anyhow = "1.0.81" log = "0.4.21" console_error_panic_hook = "0.1.7" diff --git a/windows_key_tester/Cargo.toml b/windows_key_tester/Cargo.toml index 8de3089c3..0808ab1cc 100644 --- a/windows_key_tester/Cargo.toml +++ b/windows_key_tester/Cargo.toml @@ -12,7 +12,7 @@ license = "LGPL-3.0" edition = "2021" [target.'cfg(target_os = "windows")'.dependencies] -clap = { version = "4", features = [ "std", "derive", "help", "suggestions" ], default_features = false } +clap = { version = "4", features = [ "std", "derive", "help", "suggestions" ], default-features = false } log = "0.4.8" simplelog = "0.12.0" anyhow = "1" @@ -21,7 +21,7 @@ winapi = { version = "0.3.9", features = [ "timeapi", "mmsystem", ] } -native-windows-gui = { version = "1.0.12", default_features = false } +native-windows-gui = { version = "1.0.12", default-features = false } kanata-interception = { version = "0.2.0", optional = true } kanata = { path = "..", optional = true } diff --git a/windows_key_tester/src/windows/llhook.rs b/windows_key_tester/src/windows/llhook.rs index 1ad284110..a111420ce 100644 --- a/windows_key_tester/src/windows/llhook.rs +++ b/windows_key_tester/src/windows/llhook.rs @@ -40,6 +40,7 @@ impl Drop for KeyboardHook { } /// Key event received by the low level keyboard hook. +#[allow(dead_code)] #[derive(Debug, Clone, Copy)] pub struct InputEvent { pub code: u32,