From 4efabf8d0447c9c3e7cb993edeef94e86eb58d37 Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Thu, 22 Dec 2022 10:05:11 -0600 Subject: [PATCH] make clippy happy --- ethers-solc/src/artifacts/mod.rs | 13 ++++++++++++- ethers-solc/src/cache.rs | 8 ++------ ethers-solc/src/config.rs | 8 +++++++- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ethers-solc/src/artifacts/mod.rs b/ethers-solc/src/artifacts/mod.rs index adb4116c..e79352f9 100644 --- a/ethers-solc/src/artifacts/mod.rs +++ b/ethers-solc/src/artifacts/mod.rs @@ -284,7 +284,7 @@ impl From for StandardJsonCompilerInput { } } -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Settings { /// Stop compilation after the given stage. @@ -516,6 +516,17 @@ impl Hash for Settings { } } +impl PartialEq for Settings { + fn eq(&self, other: &Self) -> bool { + self.optimizer == other.optimizer && + self.metadata == other.metadata && + self.output_selection == other.output_selection && + self.evm_version == other.evm_version && + self.via_ir == other.via_ir && + self.debug == other.debug + } +} + /// A wrapper type for all libraries in the form of `::` #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)] #[serde(transparent)] diff --git a/ethers-solc/src/cache.rs b/ethers-solc/src/cache.rs index fdce781d..a421544d 100644 --- a/ethers-solc/src/cache.rs +++ b/ethers-solc/src/cache.rs @@ -41,7 +41,7 @@ impl CompilationUnitId { version.hash(&mut hasher); solc_config.hash(&mut hasher); let result = hasher.finish(); - Self(format!("{:x}", result)) + Self(format!("{result:x}")) } } @@ -676,11 +676,7 @@ impl<'a, T: ArtifactOutput> ArtifactsCacheInner<'a, T> { } else { self.cache.compilation_units.insert( id, - CompilationUnit { - solc_config, - version, - source_units: HashSet::from([file.to_path_buf()]), - }, + CompilationUnit { solc_config, version, source_units: HashSet::from([file]) }, ); } } diff --git a/ethers-solc/src/config.rs b/ethers-solc/src/config.rs index df8df0dd..0f7a70e0 100644 --- a/ethers-solc/src/config.rs +++ b/ethers-solc/src/config.rs @@ -720,7 +720,7 @@ impl ProjectPathsConfigBuilder { } /// The config to use when compiling the contracts -#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] +#[derive(Clone, Debug, Eq, Serialize, Deserialize)] pub struct SolcConfig { /// How the file was compiled pub settings: Settings, @@ -752,6 +752,12 @@ impl Hash for SolcConfig { } } +impl PartialEq for SolcConfig { + fn eq(&self, other: &Self) -> bool { + self.settings == other.settings + } +} + #[derive(Default)] pub struct SolcConfigBuilder { settings: Option,