From 68be5072e5b6cdf0192a3fbc92713047ccf0d372 Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Fri, 20 Nov 2020 23:20:20 +0100 Subject: simplify --- src/model/bucket_table.rs | 5 ++--- src/model/key_table.rs | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/model/bucket_table.rs b/src/model/bucket_table.rs index 93421acb..b7f24d71 100644 --- a/src/model/bucket_table.rs +++ b/src/model/bucket_table.rs @@ -39,11 +39,10 @@ impl CRDT for BucketState { impl Bucket { pub fn new(name: String) -> Self { - let ret = Bucket { + Bucket { name, state: crdt::LWW::new(BucketState::Present(crdt::LWWMap::new())), - }; - ret + } } pub fn is_deleted(&self) -> bool { *self.state.get() == BucketState::Deleted diff --git a/src/model/key_table.rs b/src/model/key_table.rs index ff9d7b79..20da3cc6 100644 --- a/src/model/key_table.rs +++ b/src/model/key_table.rs @@ -31,14 +31,13 @@ impl Key { pub fn new(name: String) -> Self { let key_id = format!("GK{}", hex::encode(&rand::random::<[u8; 12]>()[..])); let secret_key = hex::encode(&rand::random::<[u8; 32]>()[..]); - let ret = Self { + Self { key_id, secret_key, name: crdt::LWW::new(name), deleted: crdt::Bool::new(false), authorized_buckets: crdt::LWWMap::new(), - }; - ret + } } pub fn delete(key_id: String) -> Self { Self { -- cgit v1.2.3