aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2022-03-14 12:00:23 +0100
committerAlex Auvolat <alex@adnab.me>2022-03-14 12:27:49 +0100
commitba6b56ae68d5842d814769418d484093865261aa (patch)
tree2620aadaa46718680ba6e66946ca487839335f56 /src/model
parent0af314b295f70fdf107524b08063f4d36fb4eeb6 (diff)
downloadgarage-ba6b56ae68d5842d814769418d484093865261aa.tar.gz
garage-ba6b56ae68d5842d814769418d484093865261aa.zip
Fix some new clippy lintsfix-resync
Diffstat (limited to 'src/model')
-rw-r--r--src/model/helper/bucket.rs6
-rw-r--r--src/model/key_table.rs3
2 files changed, 3 insertions, 6 deletions
diff --git a/src/model/helper/bucket.rs b/src/model/helper/bucket.rs
index 92b9f4cd..706faf26 100644
--- a/src/model/helper/bucket.rs
+++ b/src/model/helper/bucket.rs
@@ -30,8 +30,7 @@ impl<'a> BucketHelper<'a> {
// the AWS spec, and hex-encoded UUIDs are 64 chars long.
let hexbucket = hex::decode(bucket_name.as_str())
.ok()
- .map(|by| Uuid::try_from(&by))
- .flatten();
+ .and_then(|by| Uuid::try_from(&by));
if let Some(bucket_id) = hexbucket {
Ok(self
.0
@@ -46,8 +45,7 @@ impl<'a> BucketHelper<'a> {
.bucket_alias_table
.get(&EmptyKey, bucket_name)
.await?
- .map(|x| *x.state.get())
- .flatten())
+ .and_then(|x| *x.state.get()))
}
}
diff --git a/src/model/key_table.rs b/src/model/key_table.rs
index d5e30f3f..330e83f0 100644
--- a/src/model/key_table.rs
+++ b/src/model/key_table.rs
@@ -106,8 +106,7 @@ impl Key {
/// Get permissions for a bucket
pub fn bucket_permissions(&self, bucket: &Uuid) -> BucketKeyPerm {
self.params()
- .map(|params| params.authorized_buckets.get(bucket))
- .flatten()
+ .and_then(|params| params.authorized_buckets.get(bucket))
.cloned()
.unwrap_or(BucketKeyPerm::NO_PERMISSIONS)
}