Skip to contentSkip to conversation

rust: temporarily disable double_parens check

PATCH Superseded Paolo Bonzini 2 participants 4 messages Oct 9, 2025 – Oct 10, 2025 Rust

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rust: temporarily disable double_parens check

It is showing in the output of the bits! macro and not easy to fix there (at least not without making the macro more complex). Disable it for now.

---
 rust/Cargo.toml | 3 +++
 1 file changed, 3 insertions(+)
rust/Cargo.toml +3 -0
index 783e626802c..4f98b2c03d3 100644
@@ -109,6 +109,9 @@ used_underscore_binding = "deny"
 # nice to have, but cannot be enabled yet
 #wildcard_imports = "deny"   # still have many bindings::* imports
 
+# https://github.com/rust-lang/rust-clippy/issues/15852
+double_parens = "allow"
+
 # these may have false positives
 #option_if_let_else = "deny"
 cognitive_complexity = "deny"
Signature · 1 line
2.51.0
#1 lore raw
Quoted 9 lines · Paolo Bonzini

It is showing in the output of the bits! macro and not easy to fix there (at least not without making the macro more complex). Disable it for now.

---

How about putting it in the macro expansion instead of globally allowing it?

macro_rules! foo {
    ($a:expr, $b:expr, $c:expr, $d:expr) => {
        #[allow(clippy::double_parens)]
        InterruptMask(((($a.union($b).union($c).union($d))).into_bits()) as u32)
    }
}

Why is the double parenthesis needed here by the way? It's a method chain

Quoted 21 lines
 rust/Cargo.toml | 3 +++
 1 file changed, 3 insertions(+)
rust/Cargo.toml +3 -1
index 783e626802c..4f98b2c03d3 100644
@@ -109,6 +109,9 @@ used_underscore_binding = "deny"
 # nice to have, but cannot be enabled yet
 #wildcard_imports = "deny"   # still have many bindings::* imports
 
+# https://github.com/rust-lang/rust-clippy/issues/15852
+double_parens = "allow"
+
 # these may have false positives
 #option_if_let_else = "deny"
 cognitive_complexity = "deny"
--

2.51.0

#2 lore raw
Quoted 11 lines · Manos Pitsidianakis
Quoted 9 lines · Paolo Bonzini

It is showing in the output of the bits! macro and not easy to fix there (at least not without making the macro more complex). Disable it for now.

---

Quoted 8 lines

How about putting it in the macro expansion instead of globally allowing it?

macro_rules! foo {
     ($a:expr, $b:expr, $c:expr, $d:expr) => {
         #[allow(clippy::double_parens)]
         InterruptMask(((($a.union($b).union($c).union($d))).into_bits()) as u32)
     }
}

Can you do it for procedural macros as well?

Quoted 1 line

Why is the double parenthesis needed here by the way? It's a method chain

It's just how the macro works, occasionally generating double parentheses keeps the parser simple.

Paolo

#3 lore raw
Quoted 15 lines · Paolo Bonzini
Quoted 13 lines · Manos Pitsidianakis
Quoted 9 lines · Paolo Bonzini

It is showing in the output of the bits! macro and not easy to fix there (at least not without making the macro more complex). Disable it for now.

---

How about putting it in the macro expansion instead of globally allowing it?

Quoted 8 lines
Quoted 6 lines
macro_rules! foo {
     ($a:expr, $b:expr, $c:expr, $d:expr) => {
         #[allow(clippy::double_parens)]
         InterruptMask(((($a.union($b).union($c).union($d))).into_bits()) as u32)
     }
}

Can you do it for procedural macros as well?

Of course!

Quoted 4 lines
Quoted 2 lines

Why is the double parenthesis needed here by the way? It's a method chain

It's just how the macro works, occasionally generating double parentheses keeps the parser simple.

Makes sense.