tree-wide: add parantheses to clarify precedence

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>
This commit is contained in:
Shannon Sterz 2025-03-06 13:43:32 +01:00 committed by Wolfgang Bumiller
parent 2134657529
commit 2c07729ff3
5 changed files with 10 additions and 10 deletions

View File

@ -360,7 +360,7 @@ impl ZipEntry {
comment_len: 0, comment_len: 0,
start_disk: 0, start_disk: 0,
internal_flags: 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, offset,
}, },
) )

View File

@ -191,7 +191,7 @@ fn unescape_id(text: &str) -> Result<String, Error> {
} }
let h1 = hex_digit(i[2])?; let h1 = hex_digit(i[2])?;
let h0 = hex_digit(i[3])?; let h0 = hex_digit(i[3])?;
data.push(h1 << 4 | h0); data.push((h1 << 4) | h0);
i = &i[4..] i = &i[4..]
} else if next == b'-' { } else if next == b'-' {
data.push(b'/'); data.push(b'/');

View File

@ -90,7 +90,7 @@ fn unescape_unit_do(text: &str) -> Result<Vec<u8>, Error> {
} }
let h1 = parse_hex_digit(i[2])?; let h1 = parse_hex_digit(i[2])?;
let h0 = parse_hex_digit(i[3])?; let h0 = parse_hex_digit(i[3])?;
data.push(h1 << 4 | h0); data.push((h1 << 4) | h0);
i = &i[4..] i = &i[4..]
} else if next == b'-' { } else if next == b'-' {
data.push(b'/'); data.push(b'/');

View File

@ -97,7 +97,7 @@ fn unescape_unit_do(text: &str) -> Result<Vec<u8>, UnescapeError> {
} }
let h1 = parse_hex_digit(i[2])?; let h1 = parse_hex_digit(i[2])?;
let h0 = parse_hex_digit(i[3])?; let h0 = parse_hex_digit(i[3])?;
data.push(h1 << 4 | h0); data.push((h1 << 4) | h0);
i = &i[4..] i = &i[4..]
} else if next == b'-' { } else if next == b'-' {
data.push(b'/'); data.push(b'/');

View File

@ -103,25 +103,25 @@ impl Uuid {
return Err(UuidError); return Err(UuidError);
} }
for i in 0..4 { 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 { 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 { 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 { 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 { 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 { } else if src.len() == 32 {
let uuid: &mut [u8] = unsafe { &mut (*uuid)[..] }; let uuid: &mut [u8] = unsafe { &mut (*uuid)[..] };
let src = src.as_bytes(); let src = src.as_bytes();
for i in 0..16 { 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 { } else {
return Err(UuidError); return Err(UuidError);