From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 2/6] s3 client: refactor list buckets response status code matching
Date: Mon, 4 Aug 2025 18:09:33 +0200 [thread overview]
Message-ID: <20250804160937.660470-3-c.ebner@proxmox.com> (raw)
In-Reply-To: <20250804160937.660470-1-c.ebner@proxmox.com>
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@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
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-08-04 16:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-04 16:09 [pbs-devel] [PATCH proxmox 0/6] followups and cleanups for s3 client Christian Ebner
2025-08-04 16:09 ` [pbs-devel] [PATCH proxmox 1/6] s3 client: fix formatting issues by `cargo fmt` Christian Ebner
2025-08-04 16:09 ` Christian Ebner [this message]
2025-08-04 16:09 ` [pbs-devel] [PATCH proxmox 3/6] s3 client: refactor list buckets result list fetching Christian Ebner
2025-08-04 16:09 ` [pbs-devel] [PATCH proxmox 4/6] s3 client: add doc comments for response parser helper methods Christian Ebner
2025-08-04 16:09 ` [pbs-devel] [PATCH proxmox 5/6] s3 client: add and expand doc comments for response parsing objects Christian Ebner
2025-08-04 16:09 ` [pbs-devel] [PATCH proxmox 6/6] s3 client: add basic regression tests for response parsing Christian Ebner
2025-08-04 20:18 ` [pbs-devel] [PATCH proxmox 0/6] followups and cleanups for s3 client Thomas Lamprecht
2025-08-04 20:18 ` [pve-devel] " Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250804160937.660470-3-c.ebner@proxmox.com \
--to=c.ebner@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.