aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_list.rs
diff options
context:
space:
mode:
authorQuentin <quentin@deuxfleurs.fr>2020-11-11 16:12:42 +0100
committerQuentin <quentin@deuxfleurs.fr>2020-11-11 16:12:42 +0100
commit5a5592c176c7a17f143d0f221b6495808b7f4054 (patch)
treee368b58121f4ae5822528e54d4d8ded8c2eb2dba /src/api/s3_list.rs
parent045009da9b7ac4198574bd5aa256c11cfe4ae469 (diff)
downloadgarage-5a5592c176c7a17f143d0f221b6495808b7f4054.tar.gz
garage-5a5592c176c7a17f143d0f221b6495808b7f4054.zip
Replace with option syntaxic sugar
Diffstat (limited to 'src/api/s3_list.rs')
-rw-r--r--src/api/s3_list.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs
index 0a3b62ec..9e6bc0f5 100644
--- a/src/api/s3_list.rs
+++ b/src/api/s3_list.rs
@@ -64,10 +64,9 @@ pub async fn handle_list(
}
let common_prefix = if delimiter.len() > 0 {
let relative_key = &object.key[prefix.len()..];
- match relative_key.find(delimiter) {
- Some(i) => Some(&object.key[..prefix.len() + i + delimiter.len()]),
- None => None,
- }
+ relative_key
+ .find(delimiter)
+ .and_then(move |i| Some(&object.key[..prefix.len() + i + delimiter.len()]))
} else {
None
};