Skip to content

Commit

Permalink
refactor(remove): Pull out array removal code
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Oct 17, 2023
1 parent 5374e8a commit c259063
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cargo/util/toml_mut/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ fn fix_feature_activations(

// Remove found idx in revers order so we don't invalidate the idx.
for idx in remove_list.iter().rev() {
feature_values.remove(*idx);
remove_array_index(feature_values, *idx);
}

if status == DependencyStatus::Required {
Expand Down Expand Up @@ -538,3 +538,7 @@ fn non_existent_dependency_err(
) -> anyhow::Error {
anyhow::format_err!("the dependency `{name}` could not be found in `{table}`.")
}

fn remove_array_index(array: &mut toml_edit::Array, index: usize) {
array.remove(index);
}

0 comments on commit c259063

Please sign in to comment.