From 5879a84667952b34c9325346436008d692daa601 Mon Sep 17 00:00:00 2001 From: Georgios Konstantopoulos Date: Mon, 20 Mar 2023 21:07:30 -0700 Subject: [PATCH] Revert "chore: remove redundant clone" this was stupid This reverts commit 771326e70361728072b5806958e5847c28156421. --- ethers-solc/src/artifact_output/mod.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ethers-solc/src/artifact_output/mod.rs b/ethers-solc/src/artifact_output/mod.rs index d166841b..17da2b87 100644 --- a/ethers-solc/src/artifact_output/mod.rs +++ b/ethers-solc/src/artifact_output/mod.rs @@ -655,10 +655,11 @@ pub trait ArtifactOutput { artifacts_folder: impl AsRef, ) -> PathBuf { let artifacts_folder = artifacts_folder.as_ref(); - let mut candidate = conflict; - if let Ok(stripped) = candidate.strip_prefix(artifacts_folder) { - candidate = stripped.to_path_buf(); + let mut rel_candidate = conflict; + if let Ok(stripped) = rel_candidate.strip_prefix(artifacts_folder) { + rel_candidate = stripped.to_path_buf(); } + let mut candidate = rel_candidate.clone(); let contract_file = contract_file.as_ref(); let mut current_parent = contract_file.parent(); @@ -684,7 +685,7 @@ pub trait ArtifactOutput { loop { // this will attempt to find an alternate path by numerating the first component in the // path: `+_/....sol` - let mut components = candidate.components(); + let mut components = rel_candidate.components(); let first = components.next().expect("path not empty"); let name = first.as_os_str(); let mut numerated = OsString::with_capacity(name.len() + 2);