aboutsummaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2023-05-11 09:33:03 +0000
committerAlex <alex@adnab.me>2023-05-11 09:33:03 +0000
commit375270afd19a8ce2aa3ff99bd0fc3ccab638c223 (patch)
tree362189dcfde317ef4dd0613ab621684469c17168 /src/table
parentb925f53dc3b0bae77aa3f73e581faace2eb3b21a (diff)
parentc783194e8b8c3263fad579a85ea07d62e63b16be (diff)
downloadgarage-375270afd19a8ce2aa3ff99bd0fc3ccab638c223.tar.gz
garage-375270afd19a8ce2aa3ff99bd0fc3ccab638c223.zip
Merge pull request '*: apply clippy recommendations.' (#570) from jpds/garage:clippy-fixes into main
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/570
Diffstat (limited to 'src/table')
-rw-r--r--src/table/data.rs16
-rw-r--r--src/table/util.rs9
2 files changed, 10 insertions, 15 deletions
diff --git a/src/table/data.rs b/src/table/data.rs
index 26cc3a5a..e76836ca 100644
--- a/src/table/data.rs
+++ b/src/table/data.rs
@@ -44,22 +44,22 @@ pub struct TableData<F: TableSchema, R: TableReplication> {
impl<F: TableSchema, R: TableReplication> TableData<F, R> {
pub fn new(system: Arc<System>, instance: F, replication: R, db: &db::Db) -> Arc<Self> {
let store = db
- .open_tree(&format!("{}:table", F::TABLE_NAME))
+ .open_tree(format!("{}:table", F::TABLE_NAME))
.expect("Unable to open DB tree");
let merkle_tree = db
- .open_tree(&format!("{}:merkle_tree", F::TABLE_NAME))
+ .open_tree(format!("{}:merkle_tree", F::TABLE_NAME))
.expect("Unable to open DB Merkle tree tree");
let merkle_todo = db
- .open_tree(&format!("{}:merkle_todo", F::TABLE_NAME))
+ .open_tree(format!("{}:merkle_todo", F::TABLE_NAME))
.expect("Unable to open DB Merkle TODO tree");
let insert_queue = db
- .open_tree(&format!("{}:insert_queue", F::TABLE_NAME))
+ .open_tree(format!("{}:insert_queue", F::TABLE_NAME))
.expect("Unable to open insert queue DB tree");
let gc_todo = db
- .open_tree(&format!("{}:gc_todo_v2", F::TABLE_NAME))
+ .open_tree(format!("{}:gc_todo_v2", F::TABLE_NAME))
.expect("Unable to open GC DB tree");
let gc_todo = CountedTree::new(gc_todo).expect("Cannot count gc_todo_v2");
@@ -90,7 +90,7 @@ impl<F: TableSchema, R: TableReplication> TableData<F, R> {
pub fn read_entry(&self, p: &F::P, s: &F::S) -> Result<Option<ByteBuf>, Error> {
let tree_key = self.tree_key(p, s);
- if let Some(bytes) = self.store.get(&tree_key)? {
+ if let Some(bytes) = self.store.get(tree_key)? {
Ok(Some(ByteBuf::from(bytes.to_vec())))
} else {
Ok(None)
@@ -132,10 +132,10 @@ impl<F: TableSchema, R: TableReplication> TableData<F, R> {
}
}
- fn read_range_aux<'a>(
+ fn read_range_aux(
&self,
partition_hash: Hash,
- range: db::ValueIter<'a>,
+ range: db::ValueIter,
filter: &Option<F::Filter>,
limit: usize,
) -> Result<Vec<Arc<ByteBuf>>, Error> {
diff --git a/src/table/util.rs b/src/table/util.rs
index 0b10cf3f..663a7e11 100644
--- a/src/table/util.rs
+++ b/src/table/util.rs
@@ -34,8 +34,9 @@ impl DeletedFilter {
}
}
-#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
+#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
pub enum EnumerationOrder {
+ #[default]
Forward,
Reverse,
}
@@ -49,9 +50,3 @@ impl EnumerationOrder {
}
}
}
-
-impl Default for EnumerationOrder {
- fn default() -> Self {
- EnumerationOrder::Forward
- }
-}