From e1cce7b5b389971ffd6e5b2c212f9de632d50b90 Mon Sep 17 00:00:00 2001 From: objz Date: Mon, 24 Aug 2026 19:17:37 +0200 Subject: [PATCH] fixed fmt --- src/auth/accounts.rs | 5 +---- src/auth/tests/accounts.rs | 5 ++++- src/instance/config_sync.rs | 5 +---- src/instance/tests/logs/files.rs | 18 +++++++++++------- tests/net_mojang.rs | 7 +++++-- 5 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/auth/accounts.rs b/src/auth/accounts.rs index f314f46..e6102c4 100644 --- a/src/auth/accounts.rs +++ b/src/auth/accounts.rs @@ -128,10 +128,7 @@ impl AccountStore { let replaced = self.accounts.iter().any(|a| a.uuid == *uuid); // re-adding the currently active account must not drop the selection: // the replacement takes over the old account's active flag. - let replaced_active = self - .accounts - .iter() - .any(|a| a.uuid == *uuid && a.active); + let replaced_active = self.accounts.iter().any(|a| a.uuid == *uuid && a.active); let account_type = account.account_type.clone(); let username = account.username.clone(); self.accounts.retain(|a| a.uuid != *uuid); diff --git a/src/auth/tests/accounts.rs b/src/auth/tests/accounts.rs index 857bd56..f5ca818 100644 --- a/src/auth/tests/accounts.rs +++ b/src/auth/tests/accounts.rs @@ -152,7 +152,10 @@ fn store_set_active_out_of_bounds_keeps_selection() { store.add(create_offline_account("Alice")); store.add(create_offline_account("Bob")); store.set_active(99); - assert!(store.accounts[0].active, "existing selection must survive a bad index"); + assert!( + store.accounts[0].active, + "existing selection must survive a bad index" + ); assert!(!store.accounts[1].active); } diff --git a/src/instance/config_sync.rs b/src/instance/config_sync.rs index d9271ac..3ae13b3 100644 --- a/src/instance/config_sync.rs +++ b/src/instance/config_sync.rs @@ -243,10 +243,7 @@ fn mirror_dir(src: &Path, dst: &Path) -> Result<(), ConfigSyncError> { .into()); }; std::fs::create_dir_all(parent)?; - let name = dst - .file_name() - .and_then(|s| s.to_str()) - .unwrap_or("mirror"); + let name = dst.file_name().and_then(|s| s.to_str()).unwrap_or("mirror"); let staging = parent.join(format!(".{name}.mirror-tmp")); if staging.exists() { remove_path(&staging)?; diff --git a/src/instance/tests/logs/files.rs b/src/instance/tests/logs/files.rs index c4df251..aa413a0 100644 --- a/src/instance/tests/logs/files.rs +++ b/src/instance/tests/logs/files.rs @@ -12,15 +12,19 @@ fn create_log_file_name_has_millisecond_precision() { // stem is 22 chars: %Y-%m-%d_%H-%M-%S%3f let stem = name.strip_suffix(".log").unwrap(); assert_eq!(stem.len(), 22, "name={name}"); - assert!(stem[stem.len() - 3..].chars().all(|c| c.is_ascii_digit()), "name={name}"); + assert!( + stem[stem.len() - 3..].chars().all(|c| c.is_ascii_digit()), + "name={name}" + ); // pin the pattern: %3f must be zero-padded so names stay sortable - let dt = chrono::NaiveDateTime::parse_from_str( - "2025-01-02T15:04:05.005", - "%Y-%m-%dT%H:%M:%S%.3f", - ) - .unwrap(); - assert_eq!(dt.format("%Y-%m-%d_%H-%M-%S%3f").to_string(), "2025-01-02_15-04-05005"); + let dt = + chrono::NaiveDateTime::parse_from_str("2025-01-02T15:04:05.005", "%Y-%m-%dT%H:%M:%S%.3f") + .unwrap(); + assert_eq!( + dt.format("%Y-%m-%d_%H-%M-%S%3f").to_string(), + "2025-01-02_15-04-05005" + ); } #[test] diff --git a/tests/net_mojang.rs b/tests/net_mojang.rs index ef8fcd7..4882640 100644 --- a/tests/net_mojang.rs +++ b/tests/net_mojang.rs @@ -328,8 +328,11 @@ async fn download_libraries_downloads_and_extracts_natives() { use std::io::Write as _; let mut jar = zip::ZipWriter::new(std::io::Cursor::new(Vec::new())); - jar.start_file("META-INF/MANIFEST.MF", zip::write::SimpleFileOptions::default()) - .unwrap(); + jar.start_file( + "META-INF/MANIFEST.MF", + zip::write::SimpleFileOptions::default(), + ) + .unwrap(); jar.write_all(b"manifest").unwrap(); jar.start_file("lib/native.so", zip::write::SimpleFileOptions::default()) .unwrap();