Skip to content

Commit d7ab3b2

Browse files
client/file: Rev the list before deleting broken items
Fixes the recently updated test panic.
1 parent 58a11e8 commit d7ab3b2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

client/src/file/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ impl Keyring {
559559
}
560560
}
561561
let n_broken_items = broken_items.len();
562-
for index in broken_items {
562+
for index in broken_items.into_iter().rev() {
563563
keyring.items.remove(index);
564564
}
565565
drop(keyring);
@@ -848,8 +848,8 @@ mod tests {
848848
let keyring_path = v1_dir.join("default.keyring");
849849
fs::copy(&fixture_path, &keyring_path).await?;
850850

851-
// 1) Load with the correct password and add several valid items.
852-
// This ensures n_valid_items > n_broken_items that we'll add later.
851+
// 1) Load with the correct password and add several valid items. This ensures
852+
// n_valid_items > n_broken_items that we'll add later.
853853
let keyring = Keyring::load(&keyring_path, Secret::blob("test")).await?;
854854
for i in 0..VALID_TO_ADD {
855855
keyring
@@ -896,7 +896,6 @@ mod tests {
896896
Ok(())
897897
}
898898

899-
900899
#[tokio::test]
901900
async fn change_secret() -> Result<(), Error> {
902901
let data_dir = tempdir()?;

0 commit comments

Comments
 (0)