all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox 02/19] tree-wide: add parantheses to clarify precedence
Date: Thu,  6 Mar 2025 13:43:32 +0100	[thread overview]
Message-ID: <20250306124349.288370-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20250306124349.288370-1-s.sterz@proxmox.com>

this resolves a clippy lint that aims to improve legibility for people
unaware of rust's precendence rules [1].

[1]:
https://rust-lang.github.io/rust-clippy/master/index.html#precedence

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 proxmox-compression/src/zip.rs |  2 +-
 proxmox-schema/src/upid.rs     |  2 +-
 proxmox-sys/src/systemd.rs     |  2 +-
 proxmox-systemd/src/escape.rs  |  2 +-
 proxmox-uuid/src/lib.rs        | 12 ++++++------
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/proxmox-compression/src/zip.rs b/proxmox-compression/src/zip.rs
index 3ccece9b..11b29de4 100644
--- a/proxmox-compression/src/zip.rs
+++ b/proxmox-compression/src/zip.rs
@@ -360,7 +360,7 @@ impl ZipEntry {
                 comment_len: 0,
                 start_disk: 0,
                 internal_flags: 0,
-                external_flags: (self.mode as u32) << 16 | (!self.is_file as u32) << 4,
+                external_flags: ((self.mode as u32) << 16) | ((!self.is_file as u32) << 4),
                 offset,
             },
         )
diff --git a/proxmox-schema/src/upid.rs b/proxmox-schema/src/upid.rs
index 9bbb66a1..897fa76a 100644
--- a/proxmox-schema/src/upid.rs
+++ b/proxmox-schema/src/upid.rs
@@ -191,7 +191,7 @@ fn unescape_id(text: &str) -> Result<String, Error> {
             }
             let h1 = hex_digit(i[2])?;
             let h0 = hex_digit(i[3])?;
-            data.push(h1 << 4 | h0);
+            data.push((h1 << 4) | h0);
             i = &i[4..]
         } else if next == b'-' {
             data.push(b'/');
diff --git a/proxmox-sys/src/systemd.rs b/proxmox-sys/src/systemd.rs
index 43dc5185..d57f5816 100644
--- a/proxmox-sys/src/systemd.rs
+++ b/proxmox-sys/src/systemd.rs
@@ -90,7 +90,7 @@ fn unescape_unit_do(text: &str) -> Result<Vec<u8>, Error> {
             }
             let h1 = parse_hex_digit(i[2])?;
             let h0 = parse_hex_digit(i[3])?;
-            data.push(h1 << 4 | h0);
+            data.push((h1 << 4) | h0);
             i = &i[4..]
         } else if next == b'-' {
             data.push(b'/');
diff --git a/proxmox-systemd/src/escape.rs b/proxmox-systemd/src/escape.rs
index f73beed3..392907bc 100644
--- a/proxmox-systemd/src/escape.rs
+++ b/proxmox-systemd/src/escape.rs
@@ -97,7 +97,7 @@ fn unescape_unit_do(text: &str) -> Result<Vec<u8>, UnescapeError> {
             }
             let h1 = parse_hex_digit(i[2])?;
             let h0 = parse_hex_digit(i[3])?;
-            data.push(h1 << 4 | h0);
+            data.push((h1 << 4) | h0);
             i = &i[4..]
         } else if next == b'-' {
             data.push(b'/');
diff --git a/proxmox-uuid/src/lib.rs b/proxmox-uuid/src/lib.rs
index 09a70b49..800a8563 100644
--- a/proxmox-uuid/src/lib.rs
+++ b/proxmox-uuid/src/lib.rs
@@ -103,25 +103,25 @@ impl Uuid {
                 return Err(UuidError);
             }
             for i in 0..4 {
-                uuid[i] = hex_digit(src[2 * i])? << 4 | hex_digit(src[2 * i + 1])?;
+                uuid[i] = (hex_digit(src[2 * i])? << 4) | hex_digit(src[2 * i + 1])?;
             }
             for i in 4..6 {
-                uuid[i] = hex_digit(src[2 * i + 1])? << 4 | hex_digit(src[2 * i + 2])?;
+                uuid[i] = (hex_digit(src[2 * i + 1])? << 4) | hex_digit(src[2 * i + 2])?;
             }
             for i in 6..8 {
-                uuid[i] = hex_digit(src[2 * i + 2])? << 4 | hex_digit(src[2 * i + 3])?;
+                uuid[i] = (hex_digit(src[2 * i + 2])? << 4) | hex_digit(src[2 * i + 3])?;
             }
             for i in 8..10 {
-                uuid[i] = hex_digit(src[2 * i + 3])? << 4 | hex_digit(src[2 * i + 4])?;
+                uuid[i] = (hex_digit(src[2 * i + 3])? << 4) | hex_digit(src[2 * i + 4])?;
             }
             for i in 10..16 {
-                uuid[i] = hex_digit(src[2 * i + 4])? << 4 | hex_digit(src[2 * i + 5])?;
+                uuid[i] = (hex_digit(src[2 * i + 4])? << 4) | hex_digit(src[2 * i + 5])?;
             }
         } else if src.len() == 32 {
             let uuid: &mut [u8] = unsafe { &mut (*uuid)[..] };
             let src = src.as_bytes();
             for i in 0..16 {
-                uuid[i] = hex_digit(src[2 * i])? << 4 | hex_digit(src[2 * i + 1])?;
+                uuid[i] = (hex_digit(src[2 * i])? << 4) | hex_digit(src[2 * i + 1])?;
             }
         } else {
             return Err(UuidError);
-- 
2.39.5



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


  parent reply	other threads:[~2025-03-06 12:44 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 12:43 [pbs-devel] [PATCH proxmox 00/19] clippy, test and doc clean up Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 01/19] io: clippy fix: replace `map()` followed by `any()` with just `any()` Shannon Sterz
2025-03-06 12:43 ` Shannon Sterz [this message]
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 03/19] tree-wide: remove clone calls on types that are `Copy` Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 04/19] tfa: don't use block in conditions Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 05/19] tfa: remove needless `as_bytes` call Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 06/19] access-control/tfa: use `?` instead of unnecessary match statements Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 07/19] sys: add truncate option to `OpenOptions` in test case Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 08/19] router: allow `from_str` on Confirmation that is not for `FromStr` Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 09/19] auth-api/tfa: prefer `Display` over `ToString`/an inherent function Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 10/19] acme/auth-api: add `Default` for types with un-parameterized `new()` Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 11/19] shared-memory: specify generic types for transmute Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 12/19] router: ignore clippy lint `missing_transmute_annotations` Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 13/19] rest-server/router: ignore type complexity clippy lint Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 14/19] apt: ignore clippy lint about using a slice reference instead of `&Vec` Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 15/19] apt: ignore clippy lint about new having to return `Self` Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 16/19] network-api: ignore clippy lint about upper case acronyms Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 17/19] router: fix nested doc test cases to match inteded output Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 18/19] api-macro: re-order ObjectSchema fields to be sorted Shannon Sterz
2025-03-06 12:43 ` [pbs-devel] [PATCH proxmox 19/19] tree-wide: fix intra doc links Shannon Sterz
2025-03-06 14:26 ` [pbs-devel] applied-series: [PATCH proxmox 00/19] clippy, test and doc clean up Wolfgang Bumiller

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=20250306124349.288370-3-s.sterz@proxmox.com \
    --to=s.sterz@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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal