Skip to contentSkip to conversation

rust: bits: disable double_parens check

PATCH In review Paolo Bonzini 2 participants 2 messages Oct 10, 2025 Rust

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rust: bits: disable double_parens check

It is showing in the output of the bits! macro when using the nightly toolchain, though it's not clear if it is intentional or a bug. Shut it up for now.

---
 rust/qemu-macros/src/lib.rs | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
rust/qemu-macros/src/lib.rs +10 -3
index 3e21b67b471..9157f77a4dd 100644
@@ -401,7 +401,14 @@ pub fn bits_const_internal(ts: TokenStream) -> TokenStream {
     let ts = proc_macro2::TokenStream::from(ts);
     let mut it = ts.into_iter();
 
-    BitsConstInternal::parse(&mut it)
-        .unwrap_or_else(syn::Error::into_compile_error)
-        .into()
+    let out = BitsConstInternal::parse(&mut it)
+        .unwrap_or_else(syn::Error::into_compile_error);
+
+    // https://github.com/rust-lang/rust-clippy/issues/15852
+    quote! {
+        {
+            #[allow(clippy::double_parens)]
+            #out
+        }
+    }.into()
 }
Signature · 1 line
2.51.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Paolo Bonzini

It is showing in the output of the bits! macro when using the nightly toolchain, though it's not clear if it is intentional or a bug. Shut it up for now.

---

Quoted 28 lines
 rust/qemu-macros/src/lib.rs | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
rust/qemu-macros/src/lib.rs +10 -4
index 3e21b67b471..9157f77a4dd 100644
@@ -401,7 +401,14 @@ pub fn bits_const_internal(ts: TokenStream) -> TokenStream {
     let ts = proc_macro2::TokenStream::from(ts);
     let mut it = ts.into_iter();
 
-    BitsConstInternal::parse(&mut it)
-        .unwrap_or_else(syn::Error::into_compile_error)
-        .into()
+    let out = BitsConstInternal::parse(&mut it)
+        .unwrap_or_else(syn::Error::into_compile_error);
+
+    // https://github.com/rust-lang/rust-clippy/issues/15852
+    quote! {
+        {
+            #[allow(clippy::double_parens)]
+            #out
+        }
+    }.into()
 }
--

2.51.0