Re: [PATCH] rust: cpufreq: fix clippy::double_parens warning in Policy doctest
From: Gary Guo
Date: Wed Mar 04 2026 - 15:29:10 EST
On Wed Mar 4, 2026 at 8:07 PM GMT, John Hubbard wrote:
> On 3/4/26 12:06 PM, Gary Guo wrote:
>> On Wed Mar 4, 2026 at 7:53 PM GMT, John Hubbard wrote:
>>> Clippy reports:
>>> warning: consider removing unnecessary double parentheses
>>> --> rust/kernel/cpufreq.rs:410:60
>>> |
>>> 410 | pr_info!("The policy details are: {:?}\n", (policy.cpu(), policy.cur()));
>>> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> This looks like a false positive, probably due to how our fmt macro works?
>
> Probably, but in any case we need to remain clippy clean, so this
> work-around seems about right, yes?
>
>
> thanks,
Can you try this?
Best,
Gary
-- >8 --
diff --git a/rust/macros/fmt.rs b/rust/macros/fmt.rs
index ce6c7249305a..51988a69af21 100644
--- a/rust/macros/fmt.rs
+++ b/rust/macros/fmt.rs
@@ -2,7 +2,7 @@
use std::collections::BTreeSet;
-use proc_macro2::{Ident, TokenStream, TokenTree};
+use proc_macro2::{Group, Ident, TokenStream, TokenTree};
use quote::quote_spanned;
/// Please see [`crate::fmt`] for documentation.
@@ -69,7 +69,8 @@ pub(crate) fn fmt(input: TokenStream) -> TokenStream {
}
(None, acc)
})();
- args.extend(quote_spanned!(first_span => #lhs #adapter(&(#rhs))));
+ let rhs = Group::new(proc_macro2::Delimiter::None, rhs);
+ args.extend(quote_spanned!(first_span => #lhs #adapter(&#rhs)));
}
};