make clippy happy

This commit is contained in:
alpharush 2022-12-22 10:05:11 -06:00
parent cedabee6b0
commit 4efabf8d04
3 changed files with 21 additions and 8 deletions

View File

@ -284,7 +284,7 @@ impl From<CompilerInput> 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 `<file>:<lib>:<addr>`
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default)]
#[serde(transparent)]

View File

@ -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]) },
);
}
}

View File

@ -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<Settings>,