diff options
author | David Peter <mail@david-peter.de> | 2022-09-07 09:20:50 +0200 |
---|---|---|
committer | David Peter <david.peter@bosch.com> | 2022-09-07 09:20:50 +0200 |
commit | c7e56942f7d32e8bacab055c743bc0d3f17680b1 (patch) | |
tree | e6bf6dc049bc835f38468b7ce9faa24b0849180d | |
parent | 790e1bfa2c6571395448ffbe5d1c4820eacd497b (diff) |
Fix clippy suggestionsv1.15.0
-rw-r--r-- | src/command.rs | 4 | ||||
-rw-r--r-- | src/export/json.rs | 2 | ||||
-rw-r--r-- | src/options.rs | 6 | ||||
-rw-r--r-- | src/parameter/mod.rs | 2 | ||||
-rw-r--r-- | src/util/units.rs | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/command.rs b/src/command.rs index a3305c2..c74b908 100644 --- a/src/command.rs +++ b/src/command.rs @@ -179,7 +179,7 @@ impl<'a> Commands<'a> { 'outer: loop { let name = command_names .get(i) - .or_else(|| command_names.get(0)) + .or_else(|| command_names.first()) .copied(); i += 1; @@ -271,7 +271,7 @@ impl<'a> Commands<'a> { for cmd in &command_strings { let name = command_names .get(i) - .or_else(|| command_names.get(0)) + .or_else(|| command_names.first()) .copied(); commands.push(Command::new_parametrized( name, diff --git a/src/export/json.rs b/src/export/json.rs index 903264e..de47204 100644 --- a/src/export/json.rs +++ b/src/export/json.rs @@ -18,7 +18,7 @@ pub struct JsonExporter {} impl Exporter for JsonExporter { fn serialize(&self, results: &[BenchmarkResult], _unit: Option<Unit>) -> Result<Vec<u8>> { let mut output = to_vec_pretty(&HyperfineSummary { results }); - for content in output.iter_mut() { + if let Ok(ref mut content) = output { content.push(b'\n'); } diff --git a/src/options.rs b/src/options.rs index 8ec74ab..1ef3e01 100644 --- a/src/options.rs +++ b/src/options.rs @@ -67,7 +67,7 @@ impl Shell { } /// Action to take when an executed command fails. -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum CmdFailureAction { /// Exit with an error message RaiseError, @@ -77,7 +77,7 @@ pub enum CmdFailureAction { } /// Output style type option -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum OutputStyleOption { /// Do not output with colors or any special formatting Basic, @@ -111,7 +111,7 @@ impl Default for RunBounds { } /// How to handle the output of benchmarked commands -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, PartialEq, Eq)] pub enum CommandOutputPolicy { /// Redirect output to the null device Null, diff --git a/src/parameter/mod.rs b/src/parameter/mod.rs index 8417141..994f4a2 100644 --- a/src/parameter/mod.rs +++ b/src/parameter/mod.rs @@ -9,7 +9,7 @@ pub enum ParameterValue { Numeric(Number), } -impl<'a> ToString for ParameterValue { +impl ToString for ParameterValue { fn to_string(&self) -> String { match self { ParameterValue::Text(ref value) => value.clone(), diff --git a/src/util/units.rs b/src/util/units.rs index 5939e1d..4be7451 100644 --- a/src/util/units.rs +++ b/src/util/units.rs @@ -6,7 +6,7 @@ pub type Scalar = f64; pub type Second = Scalar; /// Supported time units -#[derive(Debug, Clone, Copy, PartialEq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Unit { Second, MilliSecond, |