aboutsummaryrefslogtreecommitdiff
path: root/src/model
diff options
context:
space:
mode:
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)
}