Skip to content

Commit

Permalink
Remove vestigial code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Hammond authored and Nathan Hammond committed Jul 18, 2023
1 parent 59e6c4e commit df2cc40
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions crates/turborepo-lib/src/rewrite_json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn get_root(json_document_string: &str) -> Result<jsonc_parser::ast::Value, Rewr
*/
fn get_closest_node<'a>(
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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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<Range> {
let mut ranges: Vec<Range> = vec![];

Expand Down Expand Up @@ -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);
}
}
Expand Down

0 comments on commit df2cc40

Please sign in to comment.