aboutsummaryrefslogtreecommitdiff
path: root/src/table
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2021-10-26 10:20:05 +0200
committerAlex Auvolat <alex@adnab.me>2021-10-26 10:20:05 +0200
commitada7899b24cacb4f95ee67ae92ddb73c04ee4d66 (patch)
treee42c200cd5eb9e9190232d4340f5be27f302342c /src/table
parentb2c51844a1dccf229473ce0c27fdb02a433ac243 (diff)
downloadgarage-ada7899b24cacb4f95ee67ae92ddb73c04ee4d66.tar.gz
garage-ada7899b24cacb4f95ee67ae92ddb73c04ee4d66.zip
Fix clippy lints (fix #121)
Diffstat (limited to 'src/table')
-rw-r--r--src/table/crdt/lww_map.rs6
-rw-r--r--src/table/crdt/map.rs6
-rw-r--r--src/table/merkle.rs4
-rw-r--r--src/table/replication/sharded.rs4
-rw-r--r--src/table/sync.rs4
5 files changed, 12 insertions, 12 deletions
diff --git a/src/table/crdt/lww_map.rs b/src/table/crdt/lww_map.rs
index 36bbf667..fb25fd46 100644
--- a/src/table/crdt/lww_map.rs
+++ b/src/table/crdt/lww_map.rs
@@ -103,7 +103,7 @@ where
}
/// Get a reference to the value assigned to a key
pub fn get(&self, k: &K) -> Option<&V> {
- match self.vals.binary_search_by(|(k2, _, _)| k2.cmp(&k)) {
+ match self.vals.binary_search_by(|(k2, _, _)| k2.cmp(k)) {
Ok(i) => Some(&self.vals[i].2),
Err(_) => None,
}
@@ -132,14 +132,14 @@ where
{
fn merge(&mut self, other: &Self) {
for (k, ts2, v2) in other.vals.iter() {
- match self.vals.binary_search_by(|(k2, _, _)| k2.cmp(&k)) {
+ match self.vals.binary_search_by(|(k2, _, _)| k2.cmp(k)) {
Ok(i) => {
let (_, ts1, _v1) = &self.vals[i];
if ts2 > ts1 {
self.vals[i].1 = *ts2;
self.vals[i].2 = v2.clone();
} else if ts1 == ts2 {
- self.vals[i].2.merge(&v2);
+ self.vals[i].2.merge(v2);
}
}
Err(i) => {
diff --git a/src/table/crdt/map.rs b/src/table/crdt/map.rs
index e2aee40a..7553cd50 100644
--- a/src/table/crdt/map.rs
+++ b/src/table/crdt/map.rs
@@ -49,7 +49,7 @@ where
/// Get a reference to the value assigned to a key
pub fn get(&self, k: &K) -> Option<&V> {
- match self.vals.binary_search_by(|(k2, _)| k2.cmp(&k)) {
+ match self.vals.binary_search_by(|(k2, _)| k2.cmp(k)) {
Ok(i) => Some(&self.vals[i].1),
Err(_) => None,
}
@@ -76,9 +76,9 @@ where
{
fn merge(&mut self, other: &Self) {
for (k, v2) in other.vals.iter() {
- match self.vals.binary_search_by(|(k2, _)| k2.cmp(&k)) {
+ match self.vals.binary_search_by(|(k2, _)| k2.cmp(k)) {
Ok(i) => {
- self.vals[i].1.merge(&v2);
+ self.vals[i].1.merge(v2);
}
Err(i) => {
self.vals.insert(i, (k.clone(), v2.clone()));
diff --git a/src/table/merkle.rs b/src/table/merkle.rs
index 5c5cbec7..56f307d3 100644
--- a/src/table/merkle.rs
+++ b/src/table/merkle.rs
@@ -167,7 +167,7 @@ where
// Calculate an update to apply to this node
// This update is an Option<_>, so that it is None if the update is a no-op
// and we can thus skip recalculating and re-storing everything
- let mutate = match self.read_node_txn(tx, &key)? {
+ let mutate = match self.read_node_txn(tx, key)? {
MerkleNode::Empty => new_vhash.map(|vhv| MerkleNode::Leaf(k.to_vec(), vhv)),
MerkleNode::Intermediate(mut children) => {
let key2 = key.next_key(khash);
@@ -270,7 +270,7 @@ where
};
if let Some(new_node) = mutate {
- let hash = self.put_node_txn(tx, &key, &new_node)?;
+ let hash = self.put_node_txn(tx, key, &new_node)?;
Ok(Some(hash))
} else {
Ok(None)
diff --git a/src/table/replication/sharded.rs b/src/table/replication/sharded.rs
index 75043a17..1cf964af 100644
--- a/src/table/replication/sharded.rs
+++ b/src/table/replication/sharded.rs
@@ -27,7 +27,7 @@ pub struct TableShardedReplication {
impl TableReplication for TableShardedReplication {
fn read_nodes(&self, hash: &Hash) -> Vec<Uuid> {
let ring = self.system.ring.borrow();
- ring.get_nodes(&hash, self.replication_factor)
+ ring.get_nodes(hash, self.replication_factor)
}
fn read_quorum(&self) -> usize {
self.read_quorum
@@ -35,7 +35,7 @@ impl TableReplication for TableShardedReplication {
fn write_nodes(&self, hash: &Hash) -> Vec<Uuid> {
let ring = self.system.ring.borrow();
- ring.get_nodes(&hash, self.replication_factor)
+ ring.get_nodes(hash, self.replication_factor)
}
fn write_quorum(&self) -> usize {
self.write_quorum
diff --git a/src/table/sync.rs b/src/table/sync.rs
index 4fcdc528..c5795f65 100644
--- a/src/table/sync.rs
+++ b/src/table/sync.rs
@@ -266,7 +266,7 @@ where
let nodes = self
.data
.replication
- .write_nodes(&begin)
+ .write_nodes(begin)
.into_iter()
.collect::<Vec<_>>();
if nodes.contains(&self.system.id) {
@@ -530,7 +530,7 @@ where
Ok(SyncRpc::RootCkDifferent(hash != *h))
}
SyncRpc::GetNode(k) => {
- let node = self.merkle.read_node(&k)?;
+ let node = self.merkle.read_node(k)?;
Ok(SyncRpc::Node(k.clone(), node))
}
SyncRpc::Items(items) => {