From: "Gary Guo" <gary@garyguo.net>
To: "John Hubbard" <jhubbard@nvidia.com>,
"Gary Guo" <gary@garyguo.net>,
"Rafael J . Wysocki" <rafael@kernel.org>,
"Viresh Kumar" <viresh.kumar@linaro.org>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun@kernel.org>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
linux-pm@vger.kernel.org, rust-for-linux@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rust: cpufreq: fix clippy::double_parens warning in Policy doctest
Date: Thu, 05 Mar 2026 12:31:54 +0000 [thread overview]
Message-ID: <DGUUMXMLYH02.2ZIPQEXAJYTEG@garyguo.net> (raw)
In-Reply-To: <0c4ae9ef-b803-4ead-a2c3-d5dc37592d5e@nvidia.com>
On Wed Mar 4, 2026 at 9:13 PM GMT, John Hubbard wrote:
> On 3/4/26 12:39 PM, Gary Guo wrote:
> ...
>> Actually `Delimiter::None` isn't fully fixed [1], so perhaps let's done use this
>> approach.
>>
>> Injecting a `#[allow(clippy::double_parens)]` would probably a better approach
>> today.
>>
>
> OK, so that gets us here:
>
> commit 924f411d6cd0cc4d702f197566f5e701915d5760 (HEAD -> fix-clippy-double-parens-v2)
> Author: John Hubbard <jhubbard@nvidia.com>
> Date: Wed Mar 4 13:07:43 2026 -0800
>
> scripts/rustdoc_test_gen.rs: suppress clippy::double_parens in doctests
>
> The fmt! proc macro wraps each format argument like &(arg). Writing a
> tuple argument such as (a, b) produces &((a, b)) after expansion.
> Clippy flags that as double parens, but the user has no way to avoid
> it because the outer parens come from the macro template.
>
> Add clippy::double_parens to the existing #![allow(...)] in the
> generated doctest wrapper block. This only covers doctests, but no
> non-doctest code in the tree currently passes a tuple to a printing
> macro.
I think we should either disable with
#[allow(clippy::double_parens, reason = "false positive before 1.92")]
fn update_policy(policy: &mut Policy) {
or disable it globally for all Rust code before 1.92.
Miguel, which one do you think is better?
Best,
Gary
>
> Suggested-by: Gary Guo <gary@garyguo.net>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
>
> diff --git a/scripts/rustdoc_test_gen.rs b/scripts/rustdoc_test_gen.rs
> index d61a77219a8c..e9ca56a3b73d 100644
> --- a/scripts/rustdoc_test_gen.rs
> +++ b/scripts/rustdoc_test_gen.rs
> @@ -208,7 +208,7 @@ macro_rules! assert_eq {{
> #[allow(unused)]
> static __DOCTEST_ANCHOR: i32 = ::core::line!() as i32 + {body_offset} + 2;
> {{
> - #![allow(unreachable_pub, clippy::disallowed_names)]
> + #![allow(unreachable_pub, clippy::disallowed_names, clippy::double_parens)]
> {body}
> main();
> }}
>
>
> thanks,
next prev parent reply other threads:[~2026-03-05 12:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-04 19:53 [PATCH] rust: cpufreq: fix clippy::double_parens warning in Policy doctest John Hubbard
2026-03-04 20:06 ` Gary Guo
2026-03-04 20:07 ` John Hubbard
2026-03-04 20:28 ` Gary Guo
2026-03-04 20:32 ` John Hubbard
2026-03-04 20:39 ` Gary Guo
2026-03-04 21:13 ` John Hubbard
2026-03-05 12:31 ` Gary Guo [this message]
2026-03-06 12:36 ` Miguel Ojeda
2026-03-07 17:09 ` [RFC PATCH] rust: kbuild: support global per-version flags Miguel Ojeda
2026-03-15 21:21 ` Miguel Ojeda
2026-03-15 21:22 ` Miguel Ojeda
2026-03-16 0:04 ` Mark Brown
2026-03-16 4:49 ` Miguel Ojeda
2026-03-16 12:50 ` Mark Brown
2026-03-16 12:31 ` Danilo Krummrich
2026-03-16 13:42 ` Miguel Ojeda
2026-03-04 20:30 ` [PATCH] rust: cpufreq: fix clippy::double_parens warning in Policy doctest Gary Guo
2026-03-04 20:34 ` John Hubbard
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=DGUUMXMLYH02.2ZIPQEXAJYTEG@garyguo.net \
--to=gary@garyguo.net \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tmgross@umich.edu \
--cc=viresh.kumar@linaro.org \
/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.