From b416c1927f3bb28aa67dc02fc76dd21201ce972f Mon Sep 17 00:00:00 2001 From: alpharush <0xalpharush@protonmail.com> Date: Sun, 25 Dec 2022 21:14:12 -0600 Subject: [PATCH] pass by reference --- ethers-solc/src/cache.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ethers-solc/src/cache.rs b/ethers-solc/src/cache.rs index 2d9a58f4..bfe5b614 100644 --- a/ethers-solc/src/cache.rs +++ b/ethers-solc/src/cache.rs @@ -37,7 +37,7 @@ pub struct CompilationUnitId(u64); impl CompilationUnitId { /// Create a unique id for each compilation unit based on compiler version and settings - pub fn new(version: Version, solc_config: SolcConfig) -> Self { + pub fn new(version: &Version, solc_config: &SolcConfig) -> Self { let mut hasher = hash_map::DefaultHasher::new(); version.hash(&mut hasher); solc_config.hash(&mut hasher); @@ -654,7 +654,7 @@ impl<'a, T: ArtifactOutput> ArtifactsCacheInner<'a, T> { .unwrap_or_default(), content_hash: source.content_hash(), source_name: utils::source_name(file, self.project.root()).into(), - compilation_unit: CompilationUnitId::new(version, self.project.solc_config.clone()), + compilation_unit: CompilationUnitId::new(&version, &self.project.solc_config), imports, version_requirement: self.edges.version_requirement(file).map(|v| v.to_string()), // artifacts remain empty until we received the compiler output @@ -674,7 +674,7 @@ impl<'a, T: ArtifactOutput> ArtifactsCacheInner<'a, T> { solc_config: SolcConfig, version: Version, ) { - let id = CompilationUnitId::new(version.clone(), solc_config.clone()); + let id = CompilationUnitId::new(&version, &solc_config); if let Some(CompilationUnit { source_units, .. }) = self.cache.compilation_units.get_mut(&id) {