From 513ffd1f129bfb2544ad5df0157022e0c64def3b Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sun, 9 Oct 2022 15:26:37 -0600 Subject: [PATCH] Apply fixes from Clippy --- src/job.rs | 4 ++-- src/nix/deployment/goal.rs | 2 +- src/nix/deployment/options.rs | 2 +- src/nix/evaluator/nix_eval_jobs.rs | 2 +- src/nix/host/local.rs | 4 +--- src/nix/key.rs | 2 +- src/progress/mod.rs | 2 +- 7 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/job.rs b/src/job.rs index 168e241..cebb532 100644 --- a/src/job.rs +++ b/src/job.rs @@ -55,7 +55,7 @@ pub struct JobMonitor { } /// The state of a job. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum JobState { /// Waiting to begin. /// @@ -73,7 +73,7 @@ pub enum JobState { } /// The type of a job. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum JobType { /// Meta. Meta, diff --git a/src/nix/deployment/goal.rs b/src/nix/deployment/goal.rs index 6f7cdd5..c3c51ea 100644 --- a/src/nix/deployment/goal.rs +++ b/src/nix/deployment/goal.rs @@ -1,7 +1,7 @@ //! Deployment goals. /// The goal of a deployment. -#[derive(Debug, Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Goal { /// Build the configurations only. Build, diff --git a/src/nix/deployment/options.rs b/src/nix/deployment/options.rs index 7798285..7a403d7 100644 --- a/src/nix/deployment/options.rs +++ b/src/nix/deployment/options.rs @@ -37,7 +37,7 @@ pub struct Options { } /// Which evaluator to use. -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum Evaluator { Chunked, Streaming, diff --git a/src/nix/evaluator/nix_eval_jobs.rs b/src/nix/evaluator/nix_eval_jobs.rs index 87e520b..171106c 100644 --- a/src/nix/evaluator/nix_eval_jobs.rs +++ b/src/nix/evaluator/nix_eval_jobs.rs @@ -338,7 +338,7 @@ mod tests { Err(e) => match e { EvalError::Global(e) => { let message = format!("{}", e); - assert!(message.find("No such file or directory").is_some()); + assert!(message.contains("No such file or directory")); } _ => { panic!("Expected a global error, got {:?}", e); diff --git a/src/nix/host/local.rs b/src/nix/host/local.rs index acebf06..47c8d0b 100644 --- a/src/nix/host/local.rs +++ b/src/nix/host/local.rs @@ -99,9 +99,7 @@ impl Host for Local { execution.set_job(self.job.clone()); - let result = execution.run().await; - - result + execution.run().await } async fn get_current_system_profile(&mut self) -> ColmenaResult { diff --git a/src/nix/key.rs b/src/nix/key.rs index b0a6fd0..c776dd4 100644 --- a/src/nix/key.rs +++ b/src/nix/key.rs @@ -67,7 +67,7 @@ struct KeySources { } /// When to upload a given key. -#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum UploadAt { /// Before activating the system profile. #[serde(rename = "pre-activation")] diff --git a/src/progress/mod.rs b/src/progress/mod.rs index e034d35..a1330f9 100644 --- a/src/progress/mod.rs +++ b/src/progress/mod.rs @@ -80,7 +80,7 @@ pub struct Line { } /// Style of a line. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum LineStyle { Normal, Success,