From 93c002a001349087e346411155dc3d0fa71e8227 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Wed, 5 Aug 2026 00:47:38 -0400 Subject: [PATCH] make clippy proud of me --- src/main.rs | 2 +- src/nix.rs | 6 +++--- src/op.rs | 8 ++------ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index ddf69fd..124a3b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -96,7 +96,7 @@ async fn run_deploy( op::validate(&jobs, op)?; - log::info!("Operation {} is valid for all nodes", op); + log::info!("Operation {op} is valid for all nodes"); let host_key_policy = if common.accept_new_host_keys { HostKeyPolicy::AcceptNew diff --git a/src/nix.rs b/src/nix.rs index 4df4fb0..6f2b4af 100644 --- a/src/nix.rs +++ b/src/nix.rs @@ -229,7 +229,7 @@ pub async fn build_closure( /// terminal state, then return. Exponential backoff 5 -> 60 seconds, 5-minute deadline. async fn poll_activation(target: &str, unit: &str, host_key_policy: HostKeyPolicy) -> Result<()> { let mut sleep_val = Duration::from_secs(5); - let deadline = Instant::now() + Duration::from_secs(300); + let deadline = Instant::now() + Duration::from_mins(5); loop { if Instant::now() >= deadline { @@ -275,11 +275,11 @@ async fn poll_activation(target: &str, unit: &str, host_key_policy: HostKeyPolic } _ => { sleep(sleep_val).await; - sleep_val = (sleep_val * 2).min(Duration::from_secs(60)); + sleep_val = (sleep_val * 2).min(Duration::from_mins(1)); } } - if sleep_val > Duration::from_secs(60) { + if sleep_val > Duration::from_mins(1) { anyhow::bail!("activation on {target}: gave up after backoff cap exceeded"); } } diff --git a/src/op.rs b/src/op.rs index c184745..5ef7190 100644 --- a/src/op.rs +++ b/src/op.rs @@ -20,12 +20,8 @@ impl fmt::Display for Operation { pub fn validate(jobs: &HashMap, op: Operation) -> anyhow::Result<()> { for (name, spec) in jobs { - match (spec.system, op) { - (SystemType::Darwin, Operation::Switch) => {} - (SystemType::Darwin, Operation::Boot) => { - anyhow::bail!("job {name}: 'boot' is not a valid darwin operation"); - } - (SystemType::Nixos, Operation::Boot | Operation::Switch) => {} + if matches!((spec.system, op), (SystemType::Darwin, Operation::Boot)) { + anyhow::bail!("job {name}: 'boot' is not a valid darwin operation"); } } -- 2.51.2