diff options
Diffstat (limited to 'database')
| -rw-r--r-- | database/src/kv/helpers.rs | 3 | ||||
| -rw-r--r-- | database/src/kv/index.rs | 1 | ||||
| -rw-r--r-- | database/src/kv/merge_iterator.rs | 2 | ||||
| -rw-r--r-- | database/src/lib.rs | 1 |
4 files changed, 5 insertions, 2 deletions
diff --git a/database/src/kv/helpers.rs b/database/src/kv/helpers.rs index dde067f..a98540f 100644 --- a/database/src/kv/helpers.rs +++ b/database/src/kv/helpers.rs @@ -13,7 +13,6 @@ pub fn write_counter(txn: &mut dyn jellykv::Transaction, t: &[u8], value: u64) - pub fn read_counter(txn: &dyn jellykv::Transaction, t: &[u8], default: u64) -> Result<u64> { Ok(txn .get(t)? - .map(|k| k.as_slice().try_into().map(RowNum::from_be_bytes).ok()) - .flatten() + .and_then(|k| k.as_slice().try_into().map(RowNum::from_be_bytes).ok()) .unwrap_or(default)) } diff --git a/database/src/kv/index.rs b/database/src/kv/index.rs index 5505079..0881cb7 100644 --- a/database/src/kv/index.rs +++ b/database/src/kv/index.rs @@ -82,6 +82,7 @@ pub fn read_count_index(txn: &dyn jellykv::Transaction, prefix: Vec<u8>) -> Resu read_counter(txn, &prefix, 0) } +#[allow(clippy::type_complexity)] pub fn iter_index<'a>( txn: &'a dyn jellykv::Transaction, prefix: Vec<u8>, diff --git a/database/src/kv/merge_iterator.rs b/database/src/kv/merge_iterator.rs index 8398ba4..e872823 100644 --- a/database/src/kv/merge_iterator.rs +++ b/database/src/kv/merge_iterator.rs @@ -7,10 +7,12 @@ use crate::RowNum; use anyhow::Result; +#[allow(clippy::type_complexity)] pub struct MergeIterator<'a> { iters: Vec<Box<dyn Iterator<Item = Result<(RowNum, Vec<u8>)>> + 'a>>, } impl<'a> MergeIterator<'a> { + #[allow(clippy::type_complexity)] pub fn new(iters: Vec<Box<dyn Iterator<Item = Result<(RowNum, Vec<u8>)>> + 'a>>) -> Self { Self { iters } } diff --git a/database/src/lib.rs b/database/src/lib.rs index 62d6073..b315fa6 100644 --- a/database/src/lib.rs +++ b/database/src/lib.rs @@ -19,6 +19,7 @@ pub trait Database: Send + Sync { fn transaction(&self, f: &mut dyn FnMut(&mut dyn Transaction) -> Result<()>) -> Result<()>; } +#[allow(clippy::type_complexity)] pub trait Transaction { fn insert(&mut self, entry: Box<Object>) -> Result<RowNum>; fn remove(&mut self, row: RowNum) -> Result<()>; |