π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
fix(rust): Apply cargo fmt and clippy fixes
Manav Rathi042dae879080
diff --git a/rust/src/sync/download.rs b/rust/src/sync/download.rsindex f4a5472660..37e231ade3 100644--- a/rust/src/sync/download.rs+++ b/rust/src/sync/download.rs@@ -13,6 +13,7 @@ use tokio::io::AsyncWriteExt;/// Manages file downloads with parallel processing and error recoverypub struct DownloadManager {api_client: ApiClient,+ #[allow(dead_code)]storage: Storage,temp_dir: PathBuf,collection_keys: HashMap<i64, Vec<u8>>,@@ -41,7 +42,7 @@ impl DownloadManager {/// Set number of concurrent downloadspub fn set_concurrent_downloads(&mut self, count: usize) {- self.concurrent_downloads = count.max(1).min(10); // Limit between 1-10+ self.concurrent_downloads = count.clamp(1, 10); // Limit between 1-10}/// Download a single file@@ -60,7 +61,7 @@ impl DownloadManager {// Check if file already existsif destination.exists() {- log::debug!("File already exists at {:?}, skipping", destination);+ log::debug!("File already exists at {destination:?}, skipping");return Ok(());}@@ -99,7 +100,7 @@ impl DownloadManager {use futures::stream::{self, StreamExt};let total = files.len();- log::info!("Starting download of {} files", total);+ log::info!("Starting download of {total} files");let mut stats = DownloadStats {total,@@ -124,7 +125,7 @@ impl DownloadManager {match result {Ok(_) => stats.successful += 1,Err(e) => {- log::error!("Download failed: {}", e);+ log::error!("Download failed: {e}");stats.failed += 1;}}@@ -225,7 +226,7 @@ impl DownloadManager {}}- log::debug!("Cleaned up {} temporary files", count);+ log::debug!("Cleaned up {count} temporary files");Ok(())}}diff --git a/rust/src/sync/engine.rs b/rust/src/sync/engine.rsindex 348ee5bc45..5c3f362df9 100644--- a/rust/src/sync/engine.rs+++ b/rust/src/sync/engine.rs@@ -36,7 +36,7 @@ impl SyncEngine {// Then sync filesstats.files = self.sync_files(account_id).await?;- log::info!("Sync completed: {:?}", stats);+ log::info!("Sync completed: {stats:?}");Ok(stats)}@@ -130,25 +130,36 @@ impl SyncEngine {continue;}- log::debug!("Syncing files for collection: {} ({})", collection.name, collection.id);+ log::debug!(+ "Syncing files for collection: {} ({})",+ collection.name,+ collection.id+ );// Get last sync time for this collection's fileslet mut last_sync = sync_store- .get_last_sync(self.account.id, &format!("collection_{}_files", collection.id))?+ .get_last_sync(+ self.account.id,+ &format!("collection_{}_files", collection.id),+ )?.unwrap_or(0);let mut has_more = true;while has_more {- log::debug!("Fetching files for collection {}, since_time: {}", collection.id, last_sync);+ log::debug!(+ "Fetching files for collection {}, since_time: {}",+ collection.id,+ last_sync+ );let (files, more) = api.get_collection_files(account_id, collection.id, last_sync).await?;has_more = more;- if files.is_empty() {- break;- }+ if files.is_empty() {+ break;+ }result.total += files.len();@@ -176,7 +187,11 @@ impl SyncEngine {size: file.thumbnail.size,},metadata: crate::models::file::MetadataInfo {- encrypted_data: file.metadata.encrypted_data.clone().unwrap_or_default(),+ encrypted_data: file+ .metadata+ .encrypted_data+ .clone()+ .unwrap_or_default(),decryption_header: file.metadata.decryption_header.clone(),},is_deleted: file.is_deleted,