fixed fmt
This commit is contained in:
1 parent
e99e307790
commit
e1cce7b5b3
5 files changed
+22
-18
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)?;
|
||||
|
||||
@@ -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]
|
||||
|
||||
+5
-2
@@ -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();
|
||||
|
||||
Reference in new issue
Block a user