[pbs-devel] [PATCH proxmox 2/6] s3 client: refactor list buckets response status code matching

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


Makes the match for status code 200 more concise by using the
matches macro.

No functional changes intended.

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

diff --git a/proxmox-s3-client/src/response_reader.rs b/proxmox-s3-client/src/response_reader.rs
index f9d7f1ac..0172805c 100644
--- a/proxmox-s3-client/src/response_reader.rs
+++ b/proxmox-s3-client/src/response_reader.rs
@@ -375,13 +375,10 @@ impl ResponseReader {
         let (parts, body) = self.response.into_parts();
         let body = body.collect().await?.to_bytes();
 
-        match parts.status {
-            StatusCode::OK => (),
-            status_code => {
-                Self::log_error_response_utf8(body);
-                bail!("unexpected status code {status_code}")
-            }
-        };
+        if !matches!(parts.status, StatusCode::OK) {
+            Self::log_error_response_utf8(body);
+            bail!("unexpected status code {}", parts.status);
+        }
 
         let body = String::from_utf8(body.to_vec())?;
 
-- 
2.47.2





More information about the pbs-devel mailing list