fix: resolve Clippy -D warnings in Tauri client

- 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)
This commit is contained in:
J3vb
2026-04-03 10:21:06 +02:00
parent 7bd37ca750
commit 9a7318dd35
4 changed files with 2 additions and 39 deletions
@@ -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();
}
}
@@ -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}"))?;
}
@@ -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<R: Runtime>(
app: &tauri::AppHandle<R>,
shortcut_str: &str,
) -> Result<(), Box<dyn std::error::Error>> {
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<R: Runtime>(
app: &tauri::AppHandle<R>,
) -> Result<(), Box<dyn std::error::Error>> {
app.global_shortcut().unregister_all()?;
Ok(())
}
-1
View File
@@ -1,6 +1,5 @@
mod commands;
mod credentials;
mod hotkeys;
mod livekit_proxy;
mod ptt;
mod tray;