qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: temporarily disable double_parens check
@ 2025-10-09 21:12 Paolo Bonzini
  2025-10-10 12:23 ` Manos Pitsidianakis
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2025-10-09 21:12 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-rust, Richard Henderson

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.

Link: https://github.com/rust-lang/rust-clippy/issues/15852
Reported-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/Cargo.toml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index 783e626802c..4f98b2c03d3 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -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



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

* Re: [PATCH] rust: temporarily disable double_parens check
  2025-10-09 21:12 [PATCH] rust: temporarily disable double_parens check Paolo Bonzini
@ 2025-10-10 12:23 ` Manos Pitsidianakis
  2025-10-10 14:12   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Manos Pitsidianakis @ 2025-10-10 12:23 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust, Richard Henderson

On Fri, Oct 10, 2025 at 12:12 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> 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.
>
> Link: https://github.com/rust-lang/rust-clippy/issues/15852
> Reported-by: Richard Henderson <richard.henderson@linaro.org>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---

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


>  rust/Cargo.toml | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/rust/Cargo.toml b/rust/Cargo.toml
> index 783e626802c..4f98b2c03d3 100644
> --- a/rust/Cargo.toml
> +++ b/rust/Cargo.toml
> @@ -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
>
>


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

* Re: [PATCH] rust: temporarily disable double_parens check
  2025-10-10 12:23 ` Manos Pitsidianakis
@ 2025-10-10 14:12   ` Paolo Bonzini
  2025-10-10 14:14     ` Manos Pitsidianakis
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2025-10-10 14:12 UTC (permalink / raw)
  To: Manos Pitsidianakis; +Cc: qemu-devel, qemu-rust, Richard Henderson

On 10/10/25 14:23, Manos Pitsidianakis wrote:
> On Fri, Oct 10, 2025 at 12:12 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>>
>> 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.
>>
>> Link: https://github.com/rust-lang/rust-clippy/issues/15852
>> Reported-by: Richard Henderson <richard.henderson@linaro.org>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
> 
> 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?

> 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



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

* Re: [PATCH] rust: temporarily disable double_parens check
  2025-10-10 14:12   ` Paolo Bonzini
@ 2025-10-10 14:14     ` Manos Pitsidianakis
  0 siblings, 0 replies; 4+ messages in thread
From: Manos Pitsidianakis @ 2025-10-10 14:14 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, qemu-rust, Richard Henderson

On Fri, Oct 10, 2025 at 5:12 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 10/10/25 14:23, Manos Pitsidianakis wrote:
> > On Fri, Oct 10, 2025 at 12:12 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
> >>
> >> 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.
> >>
> >> Link: https://github.com/rust-lang/rust-clippy/issues/15852
> >> Reported-by: Richard Henderson <richard.henderson@linaro.org>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> ---
> >
> > 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?

Of course!

>
> > 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.


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

end of thread, other threads:[~2025-10-10 14:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09 21:12 [PATCH] rust: temporarily disable double_parens check Paolo Bonzini
2025-10-10 12:23 ` Manos Pitsidianakis
2025-10-10 14:12   ` Paolo Bonzini
2025-10-10 14:14     ` Manos Pitsidianakis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).