* [PATCH v2 1/1] rust: cpufreq: suppress clippy::double_parens in Policy doctest
2026-03-12 4:19 [PATCH v2 0/1] rust: cpufreq: suppress clippy::double_parens in Policy doctest John Hubbard
@ 2026-03-12 4:19 ` John Hubbard
2026-03-12 6:03 ` [PATCH v2 0/1] " Miguel Ojeda
2026-03-12 10:11 ` Miguel Ojeda
2 siblings, 0 replies; 6+ messages in thread
From: John Hubbard @ 2026-03-12 4:19 UTC (permalink / raw)
To: Danilo Krummrich, Alexandre Courbot
Cc: Joel Fernandes, Timur Tabi, Alistair Popple, Eliot Courtney,
Shashank Sharma, Zhi Wang, David Airlie, Simona Vetter,
Bjorn Helgaas, Miguel Ojeda, Alex Gaynor, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, rust-for-linux, LKML, John Hubbard
The kernel fmt! proc macro wraps each format argument as &(arg). Passing
a tuple such as (a, b) produces &((a, b)) after expansion. Clippy flags
that as double_parens, but it is a false positive fixed in Clippy 1.92
(rust-lang/rust-clippy#15939).
Suppress the warning on the affected doctest function with a reason
attribute so it can be removed once the minimum toolchain moves
past 1.92.
Suggested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
rust/kernel/cpufreq.rs | 1 +
1 file changed, 1 insertion(+)
diff --git a/rust/kernel/cpufreq.rs b/rust/kernel/cpufreq.rs
index 76faa1ac8501..52fe061fc85e 100644
--- a/rust/kernel/cpufreq.rs
+++ b/rust/kernel/cpufreq.rs
@@ -401,6 +401,7 @@ pub fn to_table(mut self) -> Result<TableBox> {
/// ```
/// use kernel::cpufreq::{DEFAULT_TRANSITION_LATENCY_NS, Policy};
///
+/// #[allow(clippy::double_parens, reason = "false positive before 1.92")]
/// fn update_policy(policy: &mut Policy) {
/// policy
/// .set_dvfs_possible_from_any_cpu(true)
--
2.53.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 0/1] rust: cpufreq: suppress clippy::double_parens in Policy doctest
2026-03-12 4:19 [PATCH v2 0/1] rust: cpufreq: suppress clippy::double_parens in Policy doctest John Hubbard
2026-03-12 4:19 ` [PATCH v2 1/1] " John Hubbard
@ 2026-03-12 6:03 ` Miguel Ojeda
2026-03-12 6:07 ` Viresh Kumar
2026-03-12 10:11 ` Miguel Ojeda
2 siblings, 1 reply; 6+ messages in thread
From: Miguel Ojeda @ 2026-03-12 6:03 UTC (permalink / raw)
To: John Hubbard, Rafael J. Wysocki, Viresh Kumar,
open list:CPU FREQUENCY SCALING FRAMEWORK
Cc: Danilo Krummrich, Alexandre Courbot, Joel Fernandes, Timur Tabi,
Alistair Popple, Eliot Courtney, Shashank Sharma, Zhi Wang,
David Airlie, Simona Vetter, Bjorn Helgaas, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
rust-for-linux, LKML
On Thu, Mar 12, 2026 at 5:19 AM John Hubbard <jhubbard@nvidia.com> wrote:
>
> The kernel fmt! proc macro wraps each format argument as &(arg).
> Passing a tuple like (a, b) produces &((a, b)) after expansion,
> which Clippy flags as double_parens. This is a false positive,
> fixed in Clippy 1.92 (rust-lang/rust-clippy#15939), but the
> minimum toolchain (1.78) still triggers it.
>
> Add a local #[allow] with a reason attribute on the affected
> doctest function so it can be removed once the minimum toolchain
> moves past 1.92.
Cc'ing Rafael and Viresh -- do you want me to take this via rust-fixes
to clean the build log? I am planning to send a PR to Linus for this
-rc.
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/1] rust: cpufreq: suppress clippy::double_parens in Policy doctest
2026-03-12 6:03 ` [PATCH v2 0/1] " Miguel Ojeda
@ 2026-03-12 6:07 ` Viresh Kumar
2026-03-12 6:17 ` Miguel Ojeda
0 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2026-03-12 6:07 UTC (permalink / raw)
To: Miguel Ojeda
Cc: John Hubbard, Rafael J. Wysocki,
open list:CPU FREQUENCY SCALING FRAMEWORK, Danilo Krummrich,
Alexandre Courbot, Joel Fernandes, Timur Tabi, Alistair Popple,
Eliot Courtney, Shashank Sharma, Zhi Wang, David Airlie,
Simona Vetter, Bjorn Helgaas, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux, LKML
On 12-03-26, 07:03, Miguel Ojeda wrote:
> On Thu, Mar 12, 2026 at 5:19 AM John Hubbard <jhubbard@nvidia.com> wrote:
> >
> > The kernel fmt! proc macro wraps each format argument as &(arg).
> > Passing a tuple like (a, b) produces &((a, b)) after expansion,
> > which Clippy flags as double_parens. This is a false positive,
> > fixed in Clippy 1.92 (rust-lang/rust-clippy#15939), but the
> > minimum toolchain (1.78) still triggers it.
> >
> > Add a local #[allow] with a reason attribute on the affected
> > doctest function so it can be removed once the minimum toolchain
> > moves past 1.92.
>
> Cc'ing Rafael and Viresh -- do you want me to take this via rust-fixes
> to clean the build log? I am planning to send a PR to Linus for this
Thanks for cc'ing us. Yeah, please take it.
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
--
viresh
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/1] rust: cpufreq: suppress clippy::double_parens in Policy doctest
2026-03-12 6:07 ` Viresh Kumar
@ 2026-03-12 6:17 ` Miguel Ojeda
0 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2026-03-12 6:17 UTC (permalink / raw)
To: Viresh Kumar
Cc: John Hubbard, Rafael J. Wysocki,
open list:CPU FREQUENCY SCALING FRAMEWORK, Danilo Krummrich,
Alexandre Courbot, Joel Fernandes, Timur Tabi, Alistair Popple,
Eliot Courtney, Shashank Sharma, Zhi Wang, David Airlie,
Simona Vetter, Bjorn Helgaas, Miguel Ojeda, Alex Gaynor,
Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, rust-for-linux, LKML
On Thu, Mar 12, 2026 at 7:07 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> Thanks for cc'ing us. Yeah, please take it.
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Thanks for the very quick reply! Will do.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 0/1] rust: cpufreq: suppress clippy::double_parens in Policy doctest
2026-03-12 4:19 [PATCH v2 0/1] rust: cpufreq: suppress clippy::double_parens in Policy doctest John Hubbard
2026-03-12 4:19 ` [PATCH v2 1/1] " John Hubbard
2026-03-12 6:03 ` [PATCH v2 0/1] " Miguel Ojeda
@ 2026-03-12 10:11 ` Miguel Ojeda
2 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2026-03-12 10:11 UTC (permalink / raw)
To: John Hubbard
Cc: Danilo Krummrich, Alexandre Courbot, Joel Fernandes, Timur Tabi,
Alistair Popple, Eliot Courtney, Shashank Sharma, Zhi Wang,
David Airlie, Simona Vetter, Bjorn Helgaas, Miguel Ojeda,
Alex Gaynor, Boqun Feng, Gary Guo, Björn Roy Baron,
Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
rust-for-linux, LKML
On Thu, Mar 12, 2026 at 5:19 AM John Hubbard <jhubbard@nvidia.com> wrote:
>
> The kernel fmt! proc macro wraps each format argument as &(arg).
> Passing a tuple like (a, b) produces &((a, b)) after expansion,
> which Clippy flags as double_parens. This is a false positive,
> fixed in Clippy 1.92 (rust-lang/rust-clippy#15939), but the
> minimum toolchain (1.78) still triggers it.
>
> Add a local #[allow] with a reason attribute on the affected
> doctest function so it can be removed once the minimum toolchain
> moves past 1.92.
Applied to `rust-fixes` -- thanks everyone!
[ We may end up deciding to support per-version Clippy lints, in which
case we will need [3].
In the future, if [4] gets fixed, we may be able to use
`Delimiter::None` as Gary suggested in [5].
Link: https://lore.kernel.org/rust-for-linux/20260307170929.153892-1-ojeda@kernel.org/
[3]
Link: https://github.com/rust-lang/rust/issues/67062 [4]
Link: https://lore.kernel.org/rust-for-linux/DGUA5GY2DGYN.3PG0FKLG7GFN1@garyguo.net/
[5]
- Miguel ]
[ Reworded to replace GitHub-like short link with full URLs in Link tags.
Reworded reason string to match the style of a couple others we have
elsewhere. - Miguel ]
The lint doesn't trigger in stable from what I can see -- it seems to
appear with the merge of our tag that contained the `syn` rewrite
merged in 7.0, so I didn't add:
Cc: stable@vger.kernel.org # Needed in 6.18.y and later
but we could if needed (e.g. if we happen to backport the `syn` rewrite).
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread