aboutsummaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
Diffstat (limited to 'src/table')
-rw-r--r--src/table/data.rs5
-rw-r--r--src/table/gc.rs6
-rw-r--r--src/table/merkle.rs5
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)?;
}