Skip to content

Commit

Permalink
chore: remove unnecessary cloning of package dependencies (#2175)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAFrench authored Aug 4, 2023
1 parent 186375b commit 295d82e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/nargo_cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,14 @@ fn list_files_and_folders_in<P: AsRef<Path>>(path: P) -> Option<ReadDir> {
fn prepare_dependencies(
context: &mut Context,
parent_crate: CrateId,
dependencies: BTreeMap<CrateName, Dependency>,
dependencies: &BTreeMap<CrateName, Dependency>,
) {
for (dep_name, dep) in dependencies.into_iter() {
for (dep_name, dep) in dependencies.iter() {
match dep {
Dependency::Remote { package } | Dependency::Local { package } => {
let crate_id = prepare_crate(context, &package.entry_path, package.crate_type);
add_dep(context, parent_crate, crate_id, dep_name);
prepare_dependencies(context, crate_id, package.dependencies.to_owned());
add_dep(context, parent_crate, crate_id, dep_name.clone());
prepare_dependencies(context, crate_id, &package.dependencies);
}
}
}
Expand All @@ -122,7 +122,7 @@ fn prepare_package(package: &Package) -> (Context, CrateId) {

let crate_id = prepare_crate(&mut context, &package.entry_path, package.crate_type);

prepare_dependencies(&mut context, crate_id, package.dependencies.to_owned());
prepare_dependencies(&mut context, crate_id, &package.dependencies);

(context, crate_id)
}

0 comments on commit 295d82e

Please sign in to comment.