From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 4/6] schema: de: don't use while where we don't loop
Date: Wed, 28 Feb 2024 12:39:18 +0100 [thread overview]
Message-ID: <20240228113920.302844-4-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20240228113920.302844-1-m.sandoval@proxmox.com>
This code does not loop if-let is the correct pattern.
Fixes the clippy error:
error: this loop never actually loops
--> proxmox-schema/src/de/mod.rs:424:9
|
424 | / while let Some(el_range) = next_str_entry(&self.input, &mut self.at, self.has_null) {
425 | | if let Some(max) = self.schema.max_length {
426 | | if self.count == max {
427 | | return Err(Error::msg("too many elements"));
... |
438 | | .map(Some);
439 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#never_loop
= note: `#[deny(clippy::never_loop)]` on by default
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
proxmox-schema/src/de/mod.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/proxmox-schema/src/de/mod.rs b/proxmox-schema/src/de/mod.rs
index 75b500e5..09ccfeb3 100644
--- a/proxmox-schema/src/de/mod.rs
+++ b/proxmox-schema/src/de/mod.rs
@@ -421,7 +421,7 @@ impl<'de, 'i, 's> de::SeqAccess<'de> for SeqAccess<'de, 'i, 's> {
return Ok(None);
}
- while let Some(el_range) = next_str_entry(&self.input, &mut self.at, self.has_null) {
+ if let Some(el_range) = next_str_entry(&self.input, &mut self.at, self.has_null) {
if let Some(max) = self.schema.max_length {
if self.count == max {
return Err(Error::msg("too many elements"));
--
2.39.2
next prev parent reply other threads:[~2024-02-28 11:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 11:39 [pbs-devel] [PATCH proxmox 1/6] acme: Default `impl` can be derived Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 2/6] remove needless_borrow Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 3/6] io: remove unnecesary cast to *mut u8 Maximiliano Sandoval
2024-02-28 11:39 ` Maximiliano Sandoval [this message]
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 5/6] rest: do not convert string to string Maximiliano Sandoval
2024-02-28 11:39 ` [pbs-devel] [PATCH proxmox 6/6] rrd: use unwrap_or_default when possible Maximiliano Sandoval
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=20240228113920.302844-4-m.sandoval@proxmox.com \
--to=m.sandoval@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox