diff options
author | Trinity Pointard <trinity.pointard@gmail.com> | 2021-04-23 22:18:00 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2021-05-03 22:11:41 +0200 |
commit | 84856e84e5c7ccbb6cb32582c1ef71acc83396f5 (patch) | |
tree | c40ba4a3ba74d24941748c50026c43929938e1b1 /src/api/s3_list.rs | |
parent | 4a1e079e8fe2c17078a274ef17c8d63e9b1bb96e (diff) | |
download | garage-84856e84e5c7ccbb6cb32582c1ef71acc83396f5.tar.gz garage-84856e84e5c7ccbb6cb32582c1ef71acc83396f5.zip |
fix clippy warnings on api
Diffstat (limited to 'src/api/s3_list.rs')
-rw-r--r-- | src/api/s3_list.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs index 4d6c32bc..80fefd56 100644 --- a/src/api/s3_list.rs +++ b/src/api/s3_list.rs @@ -50,7 +50,7 @@ pub fn parse_list_objects_query( .ok_or_bad_request("Invalid value for max-keys") }) .unwrap_or(Ok(1000))?, - prefix: params.get("prefix").cloned().unwrap_or(String::new()), + prefix: params.get("prefix").cloned().unwrap_or_default(), marker: params.get("marker").cloned(), continuation_token: params.get("continuation-token").cloned(), start_after: params.get("start-after").cloned(), @@ -72,10 +72,13 @@ pub async fn handle_list( if let Some(ct) = &query.continuation_token { String::from_utf8(base64::decode(ct.as_bytes())?)? } else { - query.start_after.clone().unwrap_or(query.prefix.clone()) + query + .start_after + .clone() + .unwrap_or_else(|| query.prefix.clone()) } } else { - query.marker.clone().unwrap_or(query.prefix.clone()) + query.marker.clone().unwrap_or_else(|| query.prefix.clone()) }; debug!( @@ -155,7 +158,7 @@ pub async fn handle_list( truncated = None; break 'query_loop; } - if objects.len() > 0 { + if !objects.is_empty() { next_chunk_start = objects[objects.len() - 1].key.clone(); } } |