From 9a7318dd356b6a7a718ec574371a8de4622b8a14 Mon Sep 17 00:00:00 2001 From: J3vb Date: Fri, 3 Apr 2026 10:21:06 +0200 Subject: [PATCH] fix: resolve Clippy -D warnings in Tauri client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove unused `use tauri::Manager` in commands.rs - Remove dead hotkeys.rs module (register_push_to_talk, unregister_all never called) - Fix `mut cred` → immutable in credentials.rs (CredWriteW takes &CREDENTIALW) --- Client/tauri-client/src-tauri/src/commands.rs | 1 - .../tauri-client/src-tauri/src/credentials.rs | 4 +-- Client/tauri-client/src-tauri/src/hotkeys.rs | 35 ------------------- Client/tauri-client/src-tauri/src/lib.rs | 1 - 4 files changed, 2 insertions(+), 39 deletions(-) delete mode 100644 Client/tauri-client/src-tauri/src/hotkeys.rs diff --git a/Client/tauri-client/src-tauri/src/commands.rs b/Client/tauri-client/src-tauri/src/commands.rs index 00515ae2..e7e24565 100644 --- a/Client/tauri-client/src-tauri/src/commands.rs +++ b/Client/tauri-client/src-tauri/src/commands.rs @@ -146,7 +146,6 @@ pub fn get_cert_fingerprint( pub fn open_devtools(_window: tauri::WebviewWindow) { #[cfg(feature = "devtools")] { - use tauri::Manager; _window.open_devtools(); } } diff --git a/Client/tauri-client/src-tauri/src/credentials.rs b/Client/tauri-client/src-tauri/src/credentials.rs index 465f63ba..4b2cfbf9 100644 --- a/Client/tauri-client/src-tauri/src/credentials.rs +++ b/Client/tauri-client/src-tauri/src/credentials.rs @@ -79,7 +79,7 @@ pub fn save_credential(host: String, username: String, token: String, password: } let blob = payload.to_string().into_bytes(); - let mut cred = CREDENTIALW { + let cred = CREDENTIALW { Flags: CRED_FLAGS(0), Type: CRED_TYPE_GENERIC, TargetName: PWSTR(target.as_ptr() as *mut u16), @@ -95,7 +95,7 @@ pub fn save_credential(host: String, username: String, token: String, password: }; unsafe { - CredWriteW(&mut cred, 0) + CredWriteW(&cred, 0) .map_err(|e| format!("CredWriteW failed: {e}"))?; } diff --git a/Client/tauri-client/src-tauri/src/hotkeys.rs b/Client/tauri-client/src-tauri/src/hotkeys.rs deleted file mode 100644 index cf184bfd..00000000 --- a/Client/tauri-client/src-tauri/src/hotkeys.rs +++ /dev/null @@ -1,35 +0,0 @@ -use tauri::{Emitter, Runtime}; -use tauri_plugin_global_shortcut::{GlobalShortcutExt, ShortcutState}; - -/// Registers a global push-to-talk shortcut that emits `ptt-press` and -/// `ptt-release` events to the frontend webview. -pub fn register_push_to_talk( - app: &tauri::AppHandle, - shortcut_str: &str, -) -> Result<(), Box> { - let shortcut: tauri_plugin_global_shortcut::Shortcut = shortcut_str.parse()?; - - // Remove any previous binding for this shortcut before registering. - if app.global_shortcut().is_registered(shortcut) { - app.global_shortcut().unregister(shortcut)?; - } - - let handle = app.clone(); - app.global_shortcut().on_shortcut(shortcut, move |_app, _shortcut, event| { - let event_name = match event.state { - ShortcutState::Pressed => "ptt-press", - ShortcutState::Released => "ptt-release", - }; - let _ = handle.emit(event_name, ()); - })?; - - Ok(()) -} - -/// Removes all registered global shortcuts. -pub fn unregister_all( - app: &tauri::AppHandle, -) -> Result<(), Box> { - app.global_shortcut().unregister_all()?; - Ok(()) -} diff --git a/Client/tauri-client/src-tauri/src/lib.rs b/Client/tauri-client/src-tauri/src/lib.rs index ad975e52..a818d061 100644 --- a/Client/tauri-client/src-tauri/src/lib.rs +++ b/Client/tauri-client/src-tauri/src/lib.rs @@ -1,6 +1,5 @@ mod commands; mod credentials; -mod hotkeys; mod livekit_proxy; mod ptt; mod tray;