aboutsummaryrefslogtreecommitdiff
path: root/src/api/s3_list.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2020-11-11 16:38:56 +0100
committerAlex <alex@adnab.me>2020-11-11 16:38:56 +0100
commitb00e29f931dcfe79b766e2c5b2c9ddb5f6a2f200 (patch)
treee0e8e02ddaed445ec331342c2b4328829accd889 /src/api/s3_list.rs
parent045009da9b7ac4198574bd5aa256c11cfe4ae469 (diff)
parent7d7b9e95a9b7fe71e7bb42b08a22698475a9c78c (diff)
downloadgarage-b00e29f931dcfe79b766e2c5b2c9ddb5f6a2f200.tar.gz
garage-b00e29f931dcfe79b766e2c5b2c9ddb5f6a2f200.zip
Merge pull request 'Option Type: replace pattern matching by the corresponding syntaxic sugar' (#13) from feature/syntaxic-sugar into master
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/13
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..f2b49a1d 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)
+ .map(|i| &object.key[..prefix.len() + i + delimiter.len()])
} else {
None
};