style: apply rustfmt after clippy let-chain fixes

This commit is contained in:
thakares committed 2026-08-07 19:53:33 +05:30
1 parent b25a015898
commit 312c78dbbb
16 files changed
+211 -173

No files matched your search

+17 -12
View File
@@ -567,9 +567,10 @@ async fn cmd_init(
let db_path = std::path::Path::new(&sqlite_path);
println!("Creating database directory...");
if let Some(parent) = db_path.parent()
&& !parent.as_os_str().is_empty() {
std::fs::create_dir_all(parent)?;
}
&& !parent.as_os_str().is_empty()
{
std::fs::create_dir_all(parent)?;
}
// Create state directory
if let Ok(home) = std::env::var("HOME") {
@@ -664,9 +665,11 @@ async fn run_init_validation(config: &Config, admin_skipped: bool) -> anyhow::Re
let db_path = std::path::Path::new(&sqlite_path);
let mut dirs_ok = true;
if let Some(parent) = db_path.parent()
&& !parent.as_os_str().is_empty() && std::fs::create_dir_all(parent).is_err() {
dirs_ok = false;
}
&& !parent.as_os_str().is_empty()
&& std::fs::create_dir_all(parent).is_err()
{
dirs_ok = false;
}
if let Ok(home) = std::env::var("HOME") {
let state_dir = std::path::Path::new(&home).join(".local/state/nx9-auth");
if std::fs::create_dir_all(&state_dir).is_err() {
@@ -891,9 +894,10 @@ async fn cmd_backup(config: &Config, path: &std::path::Path) -> anyhow::Result<(
}
if let Some(parent) = path.parent()
&& !parent.as_os_str().is_empty() {
std::fs::create_dir_all(parent)?;
}
&& !parent.as_os_str().is_empty()
{
std::fs::create_dir_all(parent)?;
}
if path.exists() {
std::fs::remove_file(path)?;
@@ -956,9 +960,10 @@ async fn cmd_restore(config: &Config, path: &std::path::Path) -> anyhow::Result<
let sqlite_path = config.database.sqlite_path();
let target_path = std::path::Path::new(&sqlite_path);
if let Some(parent) = target_path.parent()
&& !parent.as_os_str().is_empty() {
std::fs::create_dir_all(parent)?;
}
&& !parent.as_os_str().is_empty()
{
std::fs::create_dir_all(parent)?;
}
std::fs::copy(path, target_path).with_context(|| {
format!("failed to restore backup to {}", target_path.display())
})?;