public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation
@ 2025-01-13 12:12 Maximiliano Sandoval
  2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 2/4] types: elide lifetimes when possible Maximiliano Sandoval
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Maximiliano Sandoval @ 2025-01-13 12:12 UTC (permalink / raw)
  To: pdm-devel

Fixes the manual_range_contains clippy lint:

warning: manual `!RangeInclusive::contains` implementation
   --> lib/proxmox-api-types/pve-api-types/src/types/verifiers.rs:200:12
    |
200 |         if vid > 4094 || vid < 2 {
    |            ^^^^^^^^^^^^^^^^^^^^^ help: use: `!(2..=4094).contains(&vid)`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
    = note: `#[warn(clippy::manual_range_contains)]` on by default

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 pve-api-types/src/types/verifiers.rs | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pve-api-types/src/types/verifiers.rs b/pve-api-types/src/types/verifiers.rs
index e17e190..004db9e 100644
--- a/pve-api-types/src/types/verifiers.rs
+++ b/pve-api-types/src/types/verifiers.rs
@@ -199,10 +199,10 @@ pub fn verify_pve_lxc_dev_string(s: &str) -> Result<(), Error> {
 
 pub fn verify_vlan_id_or_range(s: &str) -> Result<(), Error> {
     let check_vid = |vid: u16| -> Result<(), Error> {
-        if vid > 4094 || vid < 2 {
-            bail!("invalid VLAN tag '{vid}'");
-        } else {
+        if (2..=4094).contains(&vid) {
             Ok(())
+        } else {
+            bail!("invalid VLAN tag '{vid}'");
         }
     };
 
-- 
2.39.5



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-01-14 13:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-13 12:12 [pdm-devel] [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 2/4] types: elide lifetimes when possible Maximiliano Sandoval
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 3/4] pve-api-types: Use &str instead of format! Maximiliano Sandoval
2025-01-14 13:21   ` Wolfgang Bumiller
2025-01-13 12:12 ` [pdm-devel] [PATCH proxmox-api-types 4/4] generated code: Do not return unit value Maximiliano Sandoval
2025-01-13 12:21 ` [pdm-devel] applied: [PATCH proxmox-api-types 1/4] verifiers: Remove manual contains() implementation Dietmar Maurer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal