Skip to content

Commit 059b5b6

Browse files
committed
refactor(remove): Pull out array removal code
1 parent 767b3d6 commit 059b5b6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cargo/util/toml_mut/manifest.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ fn fix_feature_activations(
494494

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

500500
if status == DependencyStatus::Required {
@@ -538,3 +538,7 @@ fn non_existent_dependency_err(
538538
) -> anyhow::Error {
539539
anyhow::format_err!("the dependency `{name}` could not be found in `{table}`.")
540540
}
541+
542+
fn remove_array_index(array: &mut toml_edit::Array, index: usize) {
543+
array.remove(index);
544+
}

0 commit comments

Comments
 (0)