[pbs-devel] [PATCH proxmox 3/6] s3 client: refactor list buckets result list fetching

Christian Ebner c.ebner at proxmox.com
Mon Aug 4 18:09:34 CEST 2025


Instead of the match statement, use the more concise map and
unwrap_or_default.

No fuctional changes intended.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
 proxmox-s3-client/src/response_reader.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/proxmox-s3-client/src/response_reader.rs b/proxmox-s3-client/src/response_reader.rs
index 0172805c..fc9519ad 100644
--- a/proxmox-s3-client/src/response_reader.rs
+++ b/proxmox-s3-client/src/response_reader.rs
@@ -385,10 +385,10 @@ impl ResponseReader {
         let list_buckets_result: ListAllMyBucketsResult =
             serde_xml_rs::from_str(&body).context("failed to parse response body")?;
 
-        let buckets = match list_buckets_result.buckets {
-            Some(buckets) => buckets.bucket,
-            None => Vec::new(),
-        };
+        let buckets = list_buckets_result
+            .buckets
+            .map(|b| b.bucket)
+            .unwrap_or_default();
         Ok(ListBucketsResponse { buckets })
     }
 
-- 
2.47.2





More information about the pbs-devel mailing list