diff options
author | Quentin <quentin@deuxfleurs.fr> | 2020-11-11 16:12:42 +0100 |
---|---|---|
committer | Quentin <quentin@deuxfleurs.fr> | 2020-11-11 16:12:42 +0100 |
commit | 5a5592c176c7a17f143d0f221b6495808b7f4054 (patch) | |
tree | e368b58121f4ae5822528e54d4d8ded8c2eb2dba /src/api/s3_list.rs | |
parent | 045009da9b7ac4198574bd5aa256c11cfe4ae469 (diff) | |
download | garage-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.rs | 7 |
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 }; |