Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
crdt: Remove redundant `merge` function
Alexis Sellier committed 3 years ago
commit d18b67ba21c33ec7ef0bfa7febb9546a242e8f00
parent d1360bbec0ff36caa2d5e6b2f0e2b47a5123a46f
2 files changed +1 -8
modified radicle-crdt/src/clock.rs
@@ -1,6 +1,7 @@
use serde::{Deserialize, Serialize};

use crate::ord::Max;
+
use crate::Semilattice as _;

/// Lamport clock.
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
modified radicle-crdt/src/ord.rs
@@ -19,14 +19,6 @@ impl<T> Max<T> {
    }
}

-
impl<T: PartialOrd> Max<T> {
-
    pub fn merge(&mut self, other: Self) {
-
        if other.0 > self.0 {
-
            self.0 = other.0;
-
        }
-
    }
-
}
-

impl<T: num_traits::SaturatingAdd + num_traits::One> Max<T> {
    pub fn incr(&mut self) {
        self.0 = self.0.saturating_add(&T::one());