From 295d82e051bb071aa18faf5334e4fbc9d9849738 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:55:51 +0100 Subject: [PATCH] chore: remove unnecessary cloning of package dependencies (#2175) --- crates/nargo_cli/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/nargo_cli/src/lib.rs b/crates/nargo_cli/src/lib.rs index 05753f7f3d8..9cebbdabe5f 100644 --- a/crates/nargo_cli/src/lib.rs +++ b/crates/nargo_cli/src/lib.rs @@ -102,14 +102,14 @@ fn list_files_and_folders_in>(path: P) -> Option { fn prepare_dependencies( context: &mut Context, parent_crate: CrateId, - dependencies: BTreeMap, + dependencies: &BTreeMap, ) { - 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); } } } @@ -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) }