diff options
author | Alex Auvolat <alex@adnab.me> | 2022-06-06 14:08:19 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2022-06-06 14:08:19 +0200 |
commit | 0ab21e780e8b944fb2e231c45b3777add27f368d (patch) | |
tree | 00db8413787b9ea132da45fcd70bb683a7b5470d /src/table | |
parent | a77efd7ca6a02b9c668607e67efcaeeafd36a8bd (diff) | |
download | garage-0ab21e780e8b944fb2e231c45b3777add27f368d.tar.gz garage-0ab21e780e8b944fb2e231c45b3777add27f368d.zip |
Small syntax changes
Diffstat (limited to 'src/table')
-rw-r--r-- | src/table/data.rs | 5 | ||||
-rw-r--r-- | src/table/gc.rs | 6 | ||||
-rw-r--r-- | src/table/merkle.rs | 5 |
3 files changed, 4 insertions, 12 deletions
diff --git a/src/table/data.rs b/src/table/data.rs index 64ca9f14..f6d49b4d 100644 --- a/src/table/data.rs +++ b/src/table/data.rs @@ -243,10 +243,7 @@ where pub(crate) fn delete_if_equal(self: &Arc<Self>, k: &[u8], v: &[u8]) -> Result<bool, Error> { let removed = self.store.db().transaction(|mut tx| { - let remove = match tx.get(&self.store, k)? { - Some(cur_v) if cur_v == v => true, - _ => false, - }; + let remove = matches!(tx.get(&self.store, k)?, Some(cur_v) if cur_v == v => true); if remove { tx.remove(&self.store, k)?; tx.insert(&self.merkle_todo, k, vec![])?; diff --git a/src/table/gc.rs b/src/table/gc.rs index 2a23f4cc..b9c589f4 100644 --- a/src/table/gc.rs +++ b/src/table/gc.rs @@ -383,10 +383,8 @@ impl GcTodoEntry { pub(crate) fn remove_if_equal(&self, gc_todo_tree: &db::Tree) -> Result<(), Error> { let key = self.todo_table_key(); gc_todo_tree.db().transaction(|mut tx| { - let remove = match tx.get(gc_todo_tree, &key)? { - Some(ov) if ov == self.value_hash.as_slice() => true, - _ => false, - }; + let remove = + matches!(tx.get(gc_todo_tree, &key)? Some(ov) if ov == self.value_hash.as_slice()); if remove { tx.remove(gc_todo_tree, &key)?; } diff --git a/src/table/merkle.rs b/src/table/merkle.rs index 138f3ca3..e7f2442e 100644 --- a/src/table/merkle.rs +++ b/src/table/merkle.rs @@ -140,10 +140,7 @@ where .transaction(|mut tx| self.update_item_rec(&mut tx, k, &khash, &key, new_vhash))?; let deleted = self.data.merkle_todo.db().transaction(|mut tx| { - let remove = match tx.get(&self.data.merkle_todo, k)? { - Some(ov) if ov == vhash_by => true, - _ => false, - }; + let remove = matches!(tx.get(&self.data.merkle_todo, k)?, Some(ov) if ov == vhash_by); if remove { tx.remove(&self.data.merkle_todo, k)?; } |