aboutsummaryrefslogtreecommitdiff
path: root/src/table/crdt
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/crdt
parentb2c51844a1dccf229473ce0c27fdb02a433ac243 (diff)
downloadgarage-ada7899b24cacb4f95ee67ae92ddb73c04ee4d66.tar.gz
garage-ada7899b24cacb4f95ee67ae92ddb73c04ee4d66.zip
Fix clippy lints (fix #121)
Diffstat (limited to 'src/table/crdt')
-rw-r--r--src/table/crdt/lww_map.rs6
-rw-r--r--src/table/crdt/map.rs6
2 files changed, 6 insertions, 6 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()));