From a445256d861c00d949aacd20febb8db537ba6cdf Mon Sep 17 00:00:00 2001 From: Stefan Hacker Date: Sun, 12 Apr 2026 02:02:53 +0200 Subject: [PATCH] fix: Alle Rust-Warnings bereinigt - unused variables: Underscore-Prefix (_real_path, _had_changes, _file_id) - dead_code: #[allow(dead_code)] fuer zukuenftige Methoden (open_cloud_file, close_cloud_file, get_changes, LockResponse, SyncChangesResponse) Co-Authored-By: Claude Opus 4.6 (1M context) --- clients/desktop/src-tauri/src/lib.rs | 8 ++++---- clients/desktop/src-tauri/src/sync/api.rs | 3 +++ clients/desktop/src-tauri/src/sync/engine.rs | 4 +++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/clients/desktop/src-tauri/src/lib.rs b/clients/desktop/src-tauri/src/lib.rs index d2e07d4..8237f90 100644 --- a/clients/desktop/src-tauri/src/lib.rs +++ b/clients/desktop/src-tauri/src/lib.rs @@ -19,7 +19,7 @@ use std::collections::HashMap; /// Tracks a file opened from a .cloud placeholder #[derive(Clone, Debug)] struct OpenedFile { - file_id: i64, + _file_id: i64, real_path: PathBuf, cloud_name: String, // original .cloud filename } @@ -255,7 +255,7 @@ async fn open_cloud_file(state: State<'_, AppState>, cloud_path: String) -> Resu // Track opened file for auto-close detection state.opened_files.lock().unwrap().insert(file_id, OpenedFile { - file_id, + _file_id: file_id, real_path: real_path.clone(), cloud_name: path.file_name().unwrap().to_string_lossy().to_string(), }); @@ -592,7 +592,7 @@ fn start_background_sync( let state = app_w.state::(); let watchers = state.watchers.lock().unwrap(); - let mut had_changes = false; + let mut _had_changes = false; for watcher in watchers.iter() { while let Ok(change) = watcher.receiver.try_recv() { @@ -608,7 +608,7 @@ fn start_background_sync( ChangeKind::Deleted => format!("Geloescht: {}", name), }; let _ = app_w.emit("file-change", msg); - had_changes = true; + _had_changes = true; last_change = std::time::Instant::now(); pending = true; } diff --git a/clients/desktop/src-tauri/src/sync/api.rs b/clients/desktop/src-tauri/src/sync/api.rs index a8c4e8a..242311d 100644 --- a/clients/desktop/src-tauri/src/sync/api.rs +++ b/clients/desktop/src-tauri/src/sync/api.rs @@ -41,12 +41,14 @@ pub struct SyncTreeResponse { } #[derive(Debug, Serialize, Deserialize)] +#[allow(dead_code)] pub struct SyncChangesResponse { pub changes: Vec, pub server_time: String, } #[derive(Debug, Serialize, Deserialize)] +#[allow(dead_code)] pub struct LockResponse { pub locked: Option, pub locked_by: Option, @@ -127,6 +129,7 @@ impl MiniCloudApi { Ok(data.tree) } + #[allow(dead_code)] pub async fn get_changes(&self, since: &str) -> Result { let url = format!("{}/api/sync/changes?since={}", self.server_url, since); let resp = self.client.get(&url) diff --git a/clients/desktop/src-tauri/src/sync/engine.rs b/clients/desktop/src-tauri/src/sync/engine.rs index 716261a..736eb29 100644 --- a/clients/desktop/src-tauri/src/sync/engine.rs +++ b/clients/desktop/src-tauri/src/sync/engine.rs @@ -376,13 +376,14 @@ impl SyncEngine { } /// Open a .cloud placeholder file: download the real file, rename, return path + #[allow(dead_code)] pub async fn open_cloud_file(&self, cloud_path: &Path) -> Result { let content = std::fs::read_to_string(cloud_path) .map_err(|e| format!("Platzhalter lesen: {}", e))?; let placeholder: CloudPlaceholder = serde_json::from_str(&content) .map_err(|e| format!("Platzhalter ungueltig: {}", e))?; - let real_path = cloud_path.with_extension(""); + let _real_path = cloud_path.with_extension(""); // Remove .cloud extension to get real filename let real_path = cloud_path.parent().unwrap().join(&placeholder.name); @@ -399,6 +400,7 @@ impl SyncEngine { } /// Close a previously opened file: sync back, recreate .cloud, unlock + #[allow(dead_code)] pub async fn close_cloud_file(&self, real_path: &Path, file_id: i64) -> Result<(), String> { // Upload changes // We need the parent_id - for now upload to the same location