Skip to content

Commit

Permalink
refactor: use non-deprecated indexmap methods
Browse files Browse the repository at this point in the history
The `remove()` and `take()` methods are deprecated in favor of
`swap_remove()`, `shift_remove()`, `swap_take()`, and `shift_take()`,
which have been available since indexmap 1.2.0.

The "shift" variants are used in StGit because they will preserve set
order at the cost of being O(n). But since parent and patch sets are not
particularly large, perhaps not a big concern.
  • Loading branch information
jpgrayson committed Feb 4, 2024
1 parent f99f697 commit d20f35d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/stack/state.rs
Expand Up @@ -253,7 +253,7 @@ impl<'repo> StackState<'repo> {
parent_set.insert(prev_commit.id);
let prev_state = prev_state.as_ref().unwrap();
for patchname in prev_state.all_patches() {
parent_set.remove(&prev_state.patches[patchname].commit.id);
parent_set.shift_remove(&prev_state.patches[patchname].commit.id);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/stack/transaction/mod.rs
Expand Up @@ -631,7 +631,7 @@ impl<'repo> StackTransaction<'repo> {
self.hidden = hidden;

for pn in self.all_patches() {
old.take(pn)
old.shift_take(pn)
.expect("new patchname must be an old patchname");
}
assert!(
Expand Down

0 comments on commit d20f35d

Please sign in to comment.