From df2cc4090723872d8b344e514bd5ffdc815cf057 Mon Sep 17 00:00:00 2001 From: Nathan Hammond Date: Tue, 18 Jul 2023 16:13:56 +0800 Subject: [PATCH] Remove vestigial code. --- crates/turborepo-lib/src/rewrite_json.rs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/crates/turborepo-lib/src/rewrite_json.rs b/crates/turborepo-lib/src/rewrite_json.rs index 31ea0cab7aa912..9c23b6608c3d70 100644 --- a/crates/turborepo-lib/src/rewrite_json.rs +++ b/crates/turborepo-lib/src/rewrite_json.rs @@ -127,7 +127,7 @@ fn get_root(json_document_string: &str) -> Result( current_node: &'a jsonc_parser::ast::Value<'a>, - target_path: &[&'a str], + target_path: &[&str], current_path: &'a mut Vec<&'a str>, ) -> (&'a mut Vec<&'a str>, &'a jsonc_parser::ast::Value<'a>) { // No target_path? We've arrived. @@ -210,7 +210,7 @@ pub fn unset_path( // The key path can appear multiple times. This a vec that contains each time it // occurs. - let path_ranges = find_all_paths(&root, &path, &mut vec![]); + let path_ranges = find_all_paths(&root, &path); if path_ranges.is_empty() { return Ok(None); @@ -256,8 +256,7 @@ pub fn unset_path( */ fn find_all_paths<'a>( current_node: &'a jsonc_parser::ast::Value<'a>, - target_path: &[&'a str], - current_path: &mut Vec<&'a str>, + target_path: &[&str], ) -> Vec { let mut ranges: Vec = vec![]; @@ -317,13 +316,9 @@ fn find_all_paths<'a>( } else { // We must recurse. let next_current_node = &property.value; - let next_property_name = property.name.as_str(); - let next_current_path = &mut *current_path; - next_current_path.push(next_property_name); let next_target_path = &target_path[1..]; - let mut children_ranges = - find_all_paths(next_current_node, next_target_path, next_current_path); + let mut children_ranges = find_all_paths(next_current_node, next_target_path); ranges.append(&mut children_ranges); } }