From d20f35d0cdf3acda8570164c6e6371bdaa1de4d3 Mon Sep 17 00:00:00 2001 From: Peter Grayson Date: Sun, 4 Feb 2024 18:36:40 -0500 Subject: [PATCH] refactor: use non-deprecated indexmap methods 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. --- src/stack/state.rs | 2 +- src/stack/transaction/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/stack/state.rs b/src/stack/state.rs index dc0be67c..fd92b447 100644 --- a/src/stack/state.rs +++ b/src/stack/state.rs @@ -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); } } diff --git a/src/stack/transaction/mod.rs b/src/stack/transaction/mod.rs index 5b594ec0..6a55c8f1 100644 --- a/src/stack/transaction/mod.rs +++ b/src/stack/transaction/mod.rs @@ -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!(