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);
|
let replaced = self.accounts.iter().any(|a| a.uuid == *uuid);
|
||||||
// re-adding the currently active account must not drop the selection:
|
// re-adding the currently active account must not drop the selection:
|
||||||
// the replacement takes over the old account's active flag.
|
// the replacement takes over the old account's active flag.
|
||||||
let replaced_active = self
|
let replaced_active = self.accounts.iter().any(|a| a.uuid == *uuid && a.active);
|
||||||
.accounts
|
|
||||||
.iter()
|
|
||||||
.any(|a| a.uuid == *uuid && a.active);
|
|
||||||
let account_type = account.account_type.clone();
|
let account_type = account.account_type.clone();
|
||||||
let username = account.username.clone();
|
let username = account.username.clone();
|
||||||
self.accounts.retain(|a| a.uuid != *uuid);
|
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("Alice"));
|
||||||
store.add(create_offline_account("Bob"));
|
store.add(create_offline_account("Bob"));
|
||||||
store.set_active(99);
|
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);
|
assert!(!store.accounts[1].active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -243,10 +243,7 @@ fn mirror_dir(src: &Path, dst: &Path) -> Result<(), ConfigSyncError> {
|
|||||||
.into());
|
.into());
|
||||||
};
|
};
|
||||||
std::fs::create_dir_all(parent)?;
|
std::fs::create_dir_all(parent)?;
|
||||||
let name = dst
|
let name = dst.file_name().and_then(|s| s.to_str()).unwrap_or("mirror");
|
||||||
.file_name()
|
|
||||||
.and_then(|s| s.to_str())
|
|
||||||
.unwrap_or("mirror");
|
|
||||||
let staging = parent.join(format!(".{name}.mirror-tmp"));
|
let staging = parent.join(format!(".{name}.mirror-tmp"));
|
||||||
if staging.exists() {
|
if staging.exists() {
|
||||||
remove_path(&staging)?;
|
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
|
// stem is 22 chars: %Y-%m-%d_%H-%M-%S%3f
|
||||||
let stem = name.strip_suffix(".log").unwrap();
|
let stem = name.strip_suffix(".log").unwrap();
|
||||||
assert_eq!(stem.len(), 22, "name={name}");
|
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
|
// pin the pattern: %3f must be zero-padded so names stay sortable
|
||||||
let dt = chrono::NaiveDateTime::parse_from_str(
|
let dt =
|
||||||
"2025-01-02T15:04:05.005",
|
chrono::NaiveDateTime::parse_from_str("2025-01-02T15:04:05.005", "%Y-%m-%dT%H:%M:%S%.3f")
|
||||||
"%Y-%m-%dT%H:%M:%S%.3f",
|
.unwrap();
|
||||||
)
|
assert_eq!(
|
||||||
.unwrap();
|
dt.format("%Y-%m-%d_%H-%M-%S%3f").to_string(),
|
||||||
assert_eq!(dt.format("%Y-%m-%d_%H-%M-%S%3f").to_string(), "2025-01-02_15-04-05005");
|
"2025-01-02_15-04-05005"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+5
-2
@@ -328,8 +328,11 @@ async fn download_libraries_downloads_and_extracts_natives() {
|
|||||||
|
|
||||||
use std::io::Write as _;
|
use std::io::Write as _;
|
||||||
let mut jar = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
|
let mut jar = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
|
||||||
jar.start_file("META-INF/MANIFEST.MF", zip::write::SimpleFileOptions::default())
|
jar.start_file(
|
||||||
.unwrap();
|
"META-INF/MANIFEST.MF",
|
||||||
|
zip::write::SimpleFileOptions::default(),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
jar.write_all(b"manifest").unwrap();
|
jar.write_all(b"manifest").unwrap();
|
||||||
jar.start_file("lib/native.so", zip::write::SimpleFileOptions::default())
|
jar.start_file("lib/native.so", zip::write::SimpleFileOptions::default())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|||||||
Reference in new issue
Block a user