From b1b418b81a13ede548273665e83c1bc5a97dffcd Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 19 Sep 2022 10:25:03 +0200 Subject: chore: fix clippy warnings (#15944) Stop allowing clippy::derive-partial-eq-without-eq and fix warnings about deriving PartialEq without also deriving Eq. In one case I removed the PartialEq because it a) wasn't necessary, and b) sketchy because it was comparing floating point numbers. IMO, that's a good argument for enforcing the lint rule, because it would most likely have been caught during review if it had been enabled. --- cli/tools/bench.rs | 6 +++--- cli/tools/test.rs | 10 ++++++---- 2 files changed, 9 insertions(+), 7 deletions(-) (limited to 'cli/tools') diff --git a/cli/tools/bench.rs b/cli/tools/bench.rs index ccff3d615..55e98a8b9 100644 --- a/cli/tools/bench.rs +++ b/cli/tools/bench.rs @@ -41,7 +41,7 @@ struct BenchSpecifierOptions { filter: Option, } -#[derive(Debug, Clone, PartialEq, Deserialize)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] pub struct BenchPlan { pub total: usize, @@ -60,7 +60,7 @@ pub enum BenchEvent { Result(usize, BenchResult), } -#[derive(Debug, Clone, PartialEq, Deserialize)] +#[derive(Debug, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub enum BenchResult { Ok(BenchStats), @@ -84,7 +84,7 @@ pub struct BenchDescription { pub group: Option, } -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct BenchStats { pub n: u64, pub min: f64, diff --git a/cli/tools/test.rs b/cli/tools/test.rs index cb5b41042..dca140445 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -59,7 +59,7 @@ use tokio::sync::mpsc::unbounded_channel; use tokio::sync::mpsc::UnboundedSender; /// The test mode is used to determine how a specifier is to be tested. -#[derive(Debug, Clone, PartialEq)] +#[derive(Debug, Clone, Eq, PartialEq)] pub enum TestMode { /// Test as documentation, type-checking fenced code blocks. Documentation, @@ -144,13 +144,14 @@ impl TestDescription { } } -#[derive(Debug, Clone, PartialEq, Deserialize)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] pub enum TestOutput { String(String), Bytes(Vec), } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Clone, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] pub enum TestResult { @@ -160,7 +161,7 @@ pub enum TestResult { Cancelled, } -#[derive(Debug, Clone, PartialEq, Deserialize)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] pub struct TestStepDescription { pub id: usize, @@ -183,6 +184,7 @@ impl TestStepDescription { } } +#[allow(clippy::derive_partial_eq_without_eq)] #[derive(Debug, Clone, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] pub enum TestStepResult { @@ -202,7 +204,7 @@ impl TestStepResult { } } -#[derive(Debug, Clone, PartialEq, Deserialize)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize)] #[serde(rename_all = "camelCase")] pub struct TestPlan { pub origin: String, -- cgit v1.2.3