From da7907c8749f251f01c915108d23d7f899a21bbd Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Wed, 5 Jan 2022 14:01:05 -0800 Subject: [PATCH] General code cleanup --- src/command/apply.rs | 2 +- src/job.rs | 7 +------ src/nix/profile.rs | 2 +- src/util.rs | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/command/apply.rs b/src/command/apply.rs index 6ff1514..2dd385f 100644 --- a/src/command/apply.rs +++ b/src/command/apply.rs @@ -14,7 +14,7 @@ use crate::progress::SimpleProgressOutput; use crate::nix::{NixError, NodeFilter}; use crate::util; -pub fn register_deploy_args<'a>(command: App<'a>) -> App<'a> { +pub fn register_deploy_args(command: App) -> App { command .arg(Arg::new("eval-node-limit") .long("eval-node-limit") diff --git a/src/job.rs b/src/job.rs index 6dcfbac..4895359 100644 --- a/src/job.rs +++ b/src/job.rs @@ -382,10 +382,7 @@ impl JobMonitor { metadata.custom_message = message; } - let metadata = if new_state == JobState::Waiting { - // Waiting state doesn't generate user-visible output - metadata - } else { + if new_state != JobState::Waiting { if let Some(sender) = &self.progress { let text = if new_state == JobState::Succeeded { metadata.custom_message.clone() @@ -406,8 +403,6 @@ impl JobMonitor { sender.send(message).unwrap(); } } - - metadata }; self.jobs.insert(job_id, metadata); diff --git a/src/nix/profile.rs b/src/nix/profile.rs index 33a759b..bd186ec 100644 --- a/src/nix/profile.rs +++ b/src/nix/profile.rs @@ -100,7 +100,7 @@ impl TryFrom> for Profile { }); } - let path = paths.into_iter().next() + let path = paths.iter().next() .unwrap().to_owned(); Ok(Self::from_store_path_unchecked(path)) diff --git a/src/util.rs b/src/util.rs index d25448b..249557a 100644 --- a/src/util.rs +++ b/src/util.rs @@ -157,7 +157,7 @@ pub async fn hive_from_args(args: &ArgMatches) -> NixResult { Ok(hive) } -pub fn register_selector_args<'a>(command: App<'a>) -> App<'a> { +pub fn register_selector_args(command: App) -> App { command .arg(Arg::new("on") .long("on")