aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-06-06 15:10:33 +0200
committerAlex Auvolat <alex@adnab.me>2022-06-06 15:10:33 +0200
commitc56d858834bbfbe3edea2dc0c825bf3b5ce51c98 (patch)
treee6587b7f5aff6e560e0d195894d80bd5b3ff01f3 /src
parenta65049db8fbd373382f8ff73ef7a1c07c3df10e0 (diff)
downloadgarage-c56d858834bbfbe3edea2dc0c825bf3b5ce51c98.tar.gz
garage-c56d858834bbfbe3edea2dc0c825bf3b5ce51c98.zip
Fix clippy
Diffstat (limited to 'src')
-rw-r--r--src/db/lmdb_adapter.rs12
-rw-r--r--src/garage/tests/bucket.rs8
2 files changed, 9 insertions, 11 deletions
diff --git a/src/db/lmdb_adapter.rs b/src/db/lmdb_adapter.rs
index 9173ad37..3f468128 100644
--- a/src/db/lmdb_adapter.rs
+++ b/src/db/lmdb_adapter.rs
@@ -101,7 +101,7 @@ impl IDb for LmdbDb {
let tree = self.get_tree(tree)?;
let tx = self.db.read_txn()?;
- let val = tree.get(&tx, &key)?;
+ let val = tree.get(&tx, key)?;
match val {
None => Ok(None),
Some(v) => Ok(Some(v.to_vec())),
@@ -111,7 +111,7 @@ impl IDb for LmdbDb {
fn remove(&self, tree: usize, key: &[u8]) -> Result<bool> {
let tree = self.get_tree(tree)?;
let mut tx = self.db.write_txn()?;
- let deleted = tree.delete(&mut tx, &key)?;
+ let deleted = tree.delete(&mut tx, key)?;
tx.commit()?;
Ok(deleted)
}
@@ -125,7 +125,7 @@ impl IDb for LmdbDb {
fn insert(&self, tree: usize, key: &[u8], value: &[u8]) -> Result<()> {
let tree = self.get_tree(tree)?;
let mut tx = self.db.write_txn()?;
- tree.put(&mut tx, &key, &value)?;
+ tree.put(&mut tx, key, value)?;
tx.commit()?;
Ok(())
}
@@ -212,7 +212,7 @@ impl<'a, 'db> LmdbTx<'a, 'db> {
impl<'a, 'db> ITx for LmdbTx<'a, 'db> {
fn get(&self, tree: usize, key: &[u8]) -> Result<Option<Value>> {
let tree = self.get_tree(tree)?;
- match tree.get(&self.tx, &key)? {
+ match tree.get(&self.tx, key)? {
Some(v) => Ok(Some(v.to_vec())),
None => Ok(None),
}
@@ -223,12 +223,12 @@ impl<'a, 'db> ITx for LmdbTx<'a, 'db> {
fn insert(&mut self, tree: usize, key: &[u8], value: &[u8]) -> Result<()> {
let tree = *self.get_tree(tree)?;
- tree.put(&mut self.tx, &key, &value)?;
+ tree.put(&mut self.tx, key, value)?;
Ok(())
}
fn remove(&mut self, tree: usize, key: &[u8]) -> Result<bool> {
let tree = *self.get_tree(tree)?;
- let deleted = tree.delete(&mut self.tx, &key)?;
+ let deleted = tree.delete(&mut self.tx, key)?;
Ok(deleted)
}
diff --git a/src/garage/tests/bucket.rs b/src/garage/tests/bucket.rs
index ff5cc8da..b32af068 100644
--- a/src/garage/tests/bucket.rs
+++ b/src/garage/tests/bucket.rs
@@ -29,8 +29,7 @@ async fn test_bucket_all() {
.unwrap()
.iter()
.filter(|x| x.name.as_ref().is_some())
- .find(|x| x.name.as_ref().unwrap() == "hello")
- .is_some());
+ .any(|x| x.name.as_ref().unwrap() == "hello"));
}
{
// Get its location
@@ -75,13 +74,12 @@ async fn test_bucket_all() {
{
// Check bucket is deleted with List buckets
let r = ctx.client.list_buckets().send().await.unwrap();
- assert!(r
+ assert!(!r
.buckets
.as_ref()
.unwrap()
.iter()
.filter(|x| x.name.as_ref().is_some())
- .find(|x| x.name.as_ref().unwrap() == "hello")
- .is_none());
+ .any(|x| x.name.as_ref().unwrap() == "hello"));
}
}