From 57eab0e33d3ade9331b54323965027b5b951d0ed Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 29 Apr 2021 19:16:02 +1000 Subject: [PATCH] make config prefix removal undoable --- rslib/src/config/deck.rs | 2 +- rslib/src/config/mod.rs | 4 ++-- rslib/src/config/notetype.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rslib/src/config/deck.rs b/rslib/src/config/deck.rs index 89e92e2e3..8c5a7e153 100644 --- a/rslib/src/config/deck.rs +++ b/rslib/src/config/deck.rs @@ -19,7 +19,7 @@ impl DeckConfigKey { } impl Collection { - pub(crate) fn clear_aux_config_for_deck(&self, ntid: DeckId) -> Result<()> { + pub(crate) fn clear_aux_config_for_deck(&mut self, ntid: DeckId) -> Result<()> { self.remove_config_prefix(&build_aux_deck_key(ntid, "")) } diff --git a/rslib/src/config/mod.rs b/rslib/src/config/mod.rs index 6a61e18f0..d68ae4414 100644 --- a/rslib/src/config/mod.rs +++ b/rslib/src/config/mod.rs @@ -117,9 +117,9 @@ impl Collection { } /// Remove all keys starting with provided prefix, which must end with '_'. - pub(crate) fn remove_config_prefix(&self, key: &str) -> Result<()> { + pub(crate) fn remove_config_prefix(&mut self, key: &str) -> Result<()> { for (key, _val) in self.storage.get_config_prefix(key)? { - self.storage.remove_config(&key)?; + self.remove_config(key.as_str())?; } Ok(()) } diff --git a/rslib/src/config/notetype.rs b/rslib/src/config/notetype.rs index 62259e21e..2d289beb4 100644 --- a/rslib/src/config/notetype.rs +++ b/rslib/src/config/notetype.rs @@ -33,7 +33,7 @@ impl Collection { .map(|_| ()) } - pub(crate) fn clear_aux_config_for_notetype(&self, ntid: NotetypeId) -> Result<()> { + pub(crate) fn clear_aux_config_for_notetype(&mut self, ntid: NotetypeId) -> Result<()> { self.remove_config_prefix(&build_aux_notetype_key(ntid, "")) }