aboutsummaryrefslogtreecommitdiff
path: root/src/model/object_table.rs
diff options
context:
space:
mode:
authorTrinity Pointard <trinity.pointard@gmail.com>2021-04-23 21:57:32 +0200
committerAlex Auvolat <alex@adnab.me>2021-05-03 22:11:41 +0200
commit4a1e079e8fe2c17078a274ef17c8d63e9b1bb96e (patch)
tree931ae67ad8f1fc22424c3e21394de188905a9586 /src/model/object_table.rs
parentf5a0cf0414fc3db7affcbe7ffcf4e251a2afd192 (diff)
downloadgarage-4a1e079e8fe2c17078a274ef17c8d63e9b1bb96e.tar.gz
garage-4a1e079e8fe2c17078a274ef17c8d63e9b1bb96e.zip
fix clippy warnings on model
Diffstat (limited to 'src/model/object_table.rs')
-rw-r--r--src/model/object_table.rs14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/model/object_table.rs b/src/model/object_table.rs
index b0611822..f0473836 100644
--- a/src/model/object_table.rs
+++ b/src/model/object_table.rs
@@ -40,6 +40,7 @@ impl Object {
}
/// Adds a version if it wasn't already present
+ #[allow(clippy::result_unit_err)]
pub fn add_version(&mut self, new: ObjectVersion) -> Result<(), ()> {
match self
.versions
@@ -145,18 +146,12 @@ impl ObjectVersion {
/// Is the object version currently being uploaded
pub fn is_uploading(&self) -> bool {
- match self.state {
- ObjectVersionState::Uploading(_) => true,
- _ => false,
- }
+ matches!(self.state, ObjectVersionState::Uploading(_))
}
/// Is the object version completely received
pub fn is_complete(&self) -> bool {
- match self.state {
- ObjectVersionState::Complete(_) => true,
- _ => false,
- }
+ matches!(self.state, ObjectVersionState::Complete(_))
}
/// Is the object version available (received and not a tombstone)
@@ -207,8 +202,7 @@ impl CRDT for Object {
.iter()
.enumerate()
.rev()
- .filter(|(_, v)| v.is_complete())
- .next()
+ .find(|(_, v)| v.is_complete())
.map(|(vi, _)| vi);
if let Some(last_vi) = last_complete {