Small syntax changes
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing

This commit is contained in:
Alex 2022-06-06 14:08:19 +02:00
parent a77efd7ca6
commit 0ab21e780e
Signed by: lx
GPG key ID: 0E496D15096376BE
6 changed files with 18 additions and 32 deletions

View file

@ -10,9 +10,7 @@ use std::sync::{Arc, RwLock};
use heed::types::ByteSlice;
use heed::{BytesDecode, Env, RoTxn, RwTxn, UntypedDatabase as Database};
use crate::{
Db, Error, IDb, ITx, ITxFn, Result, TxError, TxFnResult, TxResult, Value, ValueIter,
};
use crate::{Db, Error, IDb, ITx, ITxFn, Result, TxError, TxFnResult, TxResult, Value, ValueIter};
pub use heed;

View file

@ -9,9 +9,7 @@ use sled::transaction::{
UnabortableTransactionError,
};
use crate::{
Db, Error, IDb, ITx, ITxFn, Result, TxError, TxFnResult, TxResult, Value, ValueIter,
};
use crate::{Db, Error, IDb, ITx, ITxFn, Result, TxError, TxFnResult, TxResult, Value, ValueIter};
pub use sled;

View file

@ -67,13 +67,12 @@ impl Repair {
let mut i = 0;
while !*must_exit.borrow() {
let item_bytes = {
let (k, v) = match self.garage.version_table.data.store.get_gt(pos)? {
Some(pair) => pair,
None => break,
};
pos = k;
v
let item_bytes = match self.garage.version_table.data.store.get_gt(pos)? {
Some((k, v)) => {
pos = k;
v
}
None => break,
};
i += 1;
@ -119,13 +118,12 @@ impl Repair {
let mut i = 0;
while !*must_exit.borrow() {
let item_bytes = {
let (k, v) = match self.garage.block_ref_table.data.store.get_gt(pos)? {
Some(pair) => pair,
None => break,
};
pos = k;
v
let item_bytes = match self.garage.block_ref_table.data.store.get_gt(pos)? {
Some((k, v)) => {
pos = k;
v
}
None => break,
};
i += 1;

View file

@ -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![])?;

View file

@ -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)?;
}

View file

@ -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)?;
}