* [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
@ 2026-03-31 20:58 Miguel Ojeda
2026-03-31 20:58 ` [PATCH 2/2] rust: macros: simplify `format!` arguments Miguel Ojeda
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Miguel Ojeda @ 2026-03-31 20:58 UTC (permalink / raw)
To: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Aaron Tomlin, linux-modules, linux-kernel,
linux-kbuild, stable
Clippy in Rust 1.88.0 (only) reports [1]:
warning: variables can be used directly in the `format!` string
--> rust/macros/module.rs:112:23
|
112 | let content = format!("{param}:{content}", param = param, content = content);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
|
112 - let content = format!("{param}:{content}", param = param, content = content);
112 + let content = format!("{param}:{content}");
warning: variables can be used directly in the `format!` string
--> rust/macros/module.rs:198:14
|
198 | t => panic!("Unsupported parameter type {}", t),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
|
198 - t => panic!("Unsupported parameter type {}", t),
198 + t => panic!("Unsupported parameter type {t}"),
|
The reason it only triggers in that version is that the lint was moved
from `pedantic` to `style` in Rust 1.88.0 and then back to `pedantic`
in Rust 1.89.0 [2][3].
In the first case, the suggestion is fair and a pure simplification, thus
we will clean it up separately.
To keep the behavior the same across all versions, and since the lint
does not work for all macros (e.g. custom ones like `pr_info!`), disable
it globally.
Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
Link: https://lore.kernel.org/rust-for-linux/CANiq72=drAtf3y_DZ-2o4jb6Az9J3Yj4QYwWnbRui4sm4AJD3Q@mail.gmail.com/ [1]
Link: https://github.com/rust-lang/rust-clippy/pull/15287 [2]
Link: https://github.com/rust-lang/rust-clippy/issues/15151 [3]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
Makefile | 1 +
1 file changed, 1 insertion(+)
diff --git a/Makefile b/Makefile
index 1a219bf1c771..a63684c36d60 100644
--- a/Makefile
+++ b/Makefile
@@ -494,6 +494,7 @@ export rust_common_flags := --edition=2021 \
-Wclippy::ptr_cast_constness \
-Wclippy::ref_as_ptr \
-Wclippy::undocumented_unsafe_blocks \
+ -Aclippy::uninlined_format_args \
-Wclippy::unnecessary_safety_comment \
-Wclippy::unnecessary_safety_doc \
-Wrustdoc::missing_crate_level_docs \
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/2] rust: macros: simplify `format!` arguments
2026-03-31 20:58 [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Miguel Ojeda
@ 2026-03-31 20:58 ` Miguel Ojeda
2026-03-31 21:07 ` Gary Guo
2026-04-03 4:53 ` Miguel Ojeda
2026-03-31 21:07 ` [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Gary Guo
` (2 subsequent siblings)
3 siblings, 2 replies; 14+ messages in thread
From: Miguel Ojeda @ 2026-03-31 20:58 UTC (permalink / raw)
To: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Aaron Tomlin, linux-modules, linux-kernel,
linux-kbuild
Clippy in Rust 1.88.0 (only) reported [1] up to the previous commit:
warning: variables can be used directly in the `format!` string
--> rust/macros/module.rs:112:23
|
112 | let content = format!("{param}:{content}", param = param, content = content);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
help: change this to
|
112 - let content = format!("{param}:{content}", param = param, content = content);
112 + let content = format!("{param}:{content}");
The reason it only triggers in that version is that the lint was moved
from `pedantic` to `style` in Rust 1.88.0 and then back to `pedantic`
in Rust 1.89.0 [2][3].
In this case, the suggestion is fair and a pure simplification, thus
just apply it.
In addition, do the same for another place in the file that Clippy does
not report because it is multi-line.
Link: https://lore.kernel.org/rust-for-linux/CANiq72=drAtf3y_DZ-2o4jb6Az9J3Yj4QYwWnbRui4sm4AJD3Q@mail.gmail.com/ [1]
Link: https://github.com/rust-lang/rust-clippy/pull/15287 [2]
Link: https://github.com/rust-lang/rust-clippy/issues/15151 [3]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
rust/macros/module.rs | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/rust/macros/module.rs b/rust/macros/module.rs
index e16298e520c7..06c18e207508 100644
--- a/rust/macros/module.rs
+++ b/rust/macros/module.rs
@@ -52,12 +52,7 @@ fn new(module: &'a str) -> Self {
fn emit_base(&mut self, field: &str, content: &str, builtin: bool, param: bool) {
let string = if builtin {
// Built-in modules prefix their modinfo strings by `module.`.
- format!(
- "{module}.{field}={content}\0",
- module = self.module,
- field = field,
- content = content
- )
+ format!("{module}.{field}={content}\0", module = self.module)
} else {
// Loadable modules' modinfo strings go as-is.
format!("{field}={content}\0")
@@ -109,7 +104,7 @@ fn emit_internal(&mut self, field: &str, content: &str, param: bool) {
}
fn emit_param(&mut self, field: &str, param: &str, content: &str) {
- let content = format!("{param}:{content}", param = param, content = content);
+ let content = format!("{param}:{content}");
self.emit_internal(field, &content, true);
}
--
2.53.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
2026-03-31 20:58 [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Miguel Ojeda
2026-03-31 20:58 ` [PATCH 2/2] rust: macros: simplify `format!` arguments Miguel Ojeda
@ 2026-03-31 21:07 ` Gary Guo
2026-03-31 21:14 ` Miguel Ojeda
2026-04-03 10:06 ` Miguel Ojeda
2026-04-03 10:24 ` Tamir Duberstein
3 siblings, 1 reply; 14+ messages in thread
From: Gary Guo @ 2026-03-31 21:07 UTC (permalink / raw)
To: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Aaron Tomlin, linux-modules, linux-kernel,
linux-kbuild, stable
On Tue Mar 31, 2026 at 9:58 PM BST, Miguel Ojeda wrote:
> Clippy in Rust 1.88.0 (only) reports [1]:
>
> warning: variables can be used directly in the `format!` string
> --> rust/macros/module.rs:112:23
> |
> 112 | let content = format!("{param}:{content}", param = param, content = content);
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> help: change this to
> |
> 112 - let content = format!("{param}:{content}", param = param, content = content);
> 112 + let content = format!("{param}:{content}");
>
> warning: variables can be used directly in the `format!` string
> --> rust/macros/module.rs:198:14
> |
> 198 | t => panic!("Unsupported parameter type {}", t),
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> help: change this to
> |
> 198 - t => panic!("Unsupported parameter type {}", t),
> 198 + t => panic!("Unsupported parameter type {t}"),
> |
>
> The reason it only triggers in that version is that the lint was moved
> from `pedantic` to `style` in Rust 1.88.0 and then back to `pedantic`
> in Rust 1.89.0 [2][3].
>
> In the first case, the suggestion is fair and a pure simplification, thus
> we will clean it up separately.
>
> To keep the behavior the same across all versions, and since the lint
> does not work for all macros (e.g. custom ones like `pr_info!`), disable
> it globally.
Does it produce a false positive, or it's a false negative? If it's the latter,
I think we don't need to disable the lint.
Best,
Gary
>
> Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
> Link: https://lore.kernel.org/rust-for-linux/CANiq72=drAtf3y_DZ-2o4jb6Az9J3Yj4QYwWnbRui4sm4AJD3Q@mail.gmail.com/ [1]
> Link: https://github.com/rust-lang/rust-clippy/pull/15287 [2]
> Link: https://github.com/rust-lang/rust-clippy/issues/15151 [3]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
> ---
> Makefile | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Makefile b/Makefile
> index 1a219bf1c771..a63684c36d60 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -494,6 +494,7 @@ export rust_common_flags := --edition=2021 \
> -Wclippy::ptr_cast_constness \
> -Wclippy::ref_as_ptr \
> -Wclippy::undocumented_unsafe_blocks \
> + -Aclippy::uninlined_format_args \
> -Wclippy::unnecessary_safety_comment \
> -Wclippy::unnecessary_safety_doc \
> -Wrustdoc::missing_crate_level_docs \
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] rust: macros: simplify `format!` arguments
2026-03-31 20:58 ` [PATCH 2/2] rust: macros: simplify `format!` arguments Miguel Ojeda
@ 2026-03-31 21:07 ` Gary Guo
2026-04-03 4:53 ` Miguel Ojeda
1 sibling, 0 replies; 14+ messages in thread
From: Gary Guo @ 2026-03-31 21:07 UTC (permalink / raw)
To: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier
Cc: Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin,
Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich,
rust-for-linux, Aaron Tomlin, linux-modules, linux-kernel,
linux-kbuild
On Tue Mar 31, 2026 at 9:58 PM BST, Miguel Ojeda wrote:
> Clippy in Rust 1.88.0 (only) reported [1] up to the previous commit:
>
> warning: variables can be used directly in the `format!` string
> --> rust/macros/module.rs:112:23
> |
> 112 | let content = format!("{param}:{content}", param = param, content = content);
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> help: change this to
> |
> 112 - let content = format!("{param}:{content}", param = param, content = content);
> 112 + let content = format!("{param}:{content}");
>
> The reason it only triggers in that version is that the lint was moved
> from `pedantic` to `style` in Rust 1.88.0 and then back to `pedantic`
> in Rust 1.89.0 [2][3].
>
> In this case, the suggestion is fair and a pure simplification, thus
> just apply it.
>
> In addition, do the same for another place in the file that Clippy does
> not report because it is multi-line.
>
> Link: https://lore.kernel.org/rust-for-linux/CANiq72=drAtf3y_DZ-2o4jb6Az9J3Yj4QYwWnbRui4sm4AJD3Q@mail.gmail.com/ [1]
> Link: https://github.com/rust-lang/rust-clippy/pull/15287 [2]
> Link: https://github.com/rust-lang/rust-clippy/issues/15151 [3]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Reviewed-by: Gary Guo <gary@garyguo.net>
> ---
> rust/macros/module.rs | 9 ++-------
> 1 file changed, 2 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
2026-03-31 21:07 ` [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Gary Guo
@ 2026-03-31 21:14 ` Miguel Ojeda
2026-03-31 21:43 ` Gary Guo
0 siblings, 1 reply; 14+ messages in thread
From: Miguel Ojeda @ 2026-03-31 21:14 UTC (permalink / raw)
To: Gary Guo
Cc: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild, stable
On Tue, Mar 31, 2026 at 11:07 PM Gary Guo <gary@garyguo.net> wrote:
>
> Does it produce a false positive, or it's a false negative? If it's the latter,
> I think we don't need to disable the lint.
If you mean for custom macros, then I think it is just that it doesn't
take those into account at all. So I guess you could say false
negative if you consider that it should.
In any case, originally I just cleaned it, because it wasn't a big
deal either way, but then I thought it would be best to keep the
behavior the same. So either we disable or enable everywhere.
Cheers,
Miguel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
2026-03-31 21:14 ` Miguel Ojeda
@ 2026-03-31 21:43 ` Gary Guo
2026-03-31 21:53 ` Miguel Ojeda
0 siblings, 1 reply; 14+ messages in thread
From: Gary Guo @ 2026-03-31 21:43 UTC (permalink / raw)
To: Miguel Ojeda, Gary Guo
Cc: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild, stable
On Tue Mar 31, 2026 at 10:14 PM BST, Miguel Ojeda wrote:
> On Tue, Mar 31, 2026 at 11:07 PM Gary Guo <gary@garyguo.net> wrote:
>>
>> Does it produce a false positive, or it's a false negative? If it's the latter,
>> I think we don't need to disable the lint.
>
> If you mean for custom macros, then I think it is just that it doesn't
> take those into account at all. So I guess you could say false
> negative if you consider that it should.
>
> In any case, originally I just cleaned it, because it wasn't a big
> deal either way, but then I thought it would be best to keep the
> behavior the same. So either we disable or enable everywhere.
>
> Cheers,
> Miguel
I mean the lint is kinda useful, and I don't want to disable it just because
it doesn't exist in older versions of rustc.
Best,
Gary
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
2026-03-31 21:43 ` Gary Guo
@ 2026-03-31 21:53 ` Miguel Ojeda
2026-04-01 15:36 ` Gary Guo
0 siblings, 1 reply; 14+ messages in thread
From: Miguel Ojeda @ 2026-03-31 21:53 UTC (permalink / raw)
To: Gary Guo
Cc: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild, stable
On Tue, Mar 31, 2026 at 11:43 PM Gary Guo <gary@garyguo.net> wrote:
>
> I mean the lint is kinda useful, and I don't want to disable it just because
> it doesn't exist in older versions of rustc.
Yeah, personally I like the inlined way, i.e. I use it myself, so I
don't mind enabling it everywhere if people is happy that it only
applies to some cases.
Another consideration is that the issue linked mentions that they
don't want to mix inline and not (for field access cases), so that
could be annoying for some, which is why they moved it back.
Either way sounds fine for me.
Anyway, if we enable it, I should apply the other suggestion too, put
the Cc: stable@ on them, and switch to `-W` here and remove the Cc:
stable@.
Thanks for taking a look!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
2026-03-31 21:53 ` Miguel Ojeda
@ 2026-04-01 15:36 ` Gary Guo
0 siblings, 0 replies; 14+ messages in thread
From: Gary Guo @ 2026-04-01 15:36 UTC (permalink / raw)
To: Miguel Ojeda, Gary Guo
Cc: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier, Boqun Feng,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild, stable
On Tue Mar 31, 2026 at 10:53 PM BST, Miguel Ojeda wrote:
> On Tue, Mar 31, 2026 at 11:43 PM Gary Guo <gary@garyguo.net> wrote:
>>
>> I mean the lint is kinda useful, and I don't want to disable it just because
>> it doesn't exist in older versions of rustc.
>
> Yeah, personally I like the inlined way, i.e. I use it myself, so I
> don't mind enabling it everywhere if people is happy that it only
> applies to some cases.
>
> Another consideration is that the issue linked mentions that they
> don't want to mix inline and not (for field access cases), so that
> could be annoying for some, which is why they moved it back.
For mixed cases I suppose it's really up to personal taste. In that case we can
say it does have "false positive" and allow the lint.
Best,
Gary
>
> Either way sounds fine for me.
>
> Anyway, if we enable it, I should apply the other suggestion too, put
> the Cc: stable@ on them, and switch to `-W` here and remove the Cc:
> stable@.
>
> Thanks for taking a look!
>
> Cheers,
> Miguel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] rust: macros: simplify `format!` arguments
2026-03-31 20:58 ` [PATCH 2/2] rust: macros: simplify `format!` arguments Miguel Ojeda
2026-03-31 21:07 ` Gary Guo
@ 2026-04-03 4:53 ` Miguel Ojeda
2026-04-03 15:52 ` Sami Tolvanen
1 sibling, 1 reply; 14+ messages in thread
From: Miguel Ojeda @ 2026-04-03 4:53 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Luis Chamberlain, Petr Pavlu, Daniel Gomez, Sami Tolvanen,
Nathan Chancellor, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild
On Tue, Mar 31, 2026 at 10:59 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Clippy in Rust 1.88.0 (only) reported [1] up to the previous commit:
>
> warning: variables can be used directly in the `format!` string
> --> rust/macros/module.rs:112:23
> |
> 112 | let content = format!("{param}:{content}", param = param, content = content);
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> help: change this to
> |
> 112 - let content = format!("{param}:{content}", param = param, content = content);
> 112 + let content = format!("{param}:{content}");
>
> The reason it only triggers in that version is that the lint was moved
> from `pedantic` to `style` in Rust 1.88.0 and then back to `pedantic`
> in Rust 1.89.0 [2][3].
>
> In this case, the suggestion is fair and a pure simplification, thus
> just apply it.
>
> In addition, do the same for another place in the file that Clippy does
> not report because it is multi-line.
>
> Link: https://lore.kernel.org/rust-for-linux/CANiq72=drAtf3y_DZ-2o4jb6Az9J3Yj4QYwWnbRui4sm4AJD3Q@mail.gmail.com/ [1]
> Link: https://github.com/rust-lang/rust-clippy/pull/15287 [2]
> Link: https://github.com/rust-lang/rust-clippy/issues/15151 [3]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
I will pick this one up together with the other one, but if someone
prefers that I don't, please shout (e.g. if modules wants to pick it
themselves).
An Acked-by is also appreciated, thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
2026-03-31 20:58 [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Miguel Ojeda
2026-03-31 20:58 ` [PATCH 2/2] rust: macros: simplify `format!` arguments Miguel Ojeda
2026-03-31 21:07 ` [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Gary Guo
@ 2026-04-03 10:06 ` Miguel Ojeda
2026-04-03 10:24 ` Tamir Duberstein
3 siblings, 0 replies; 14+ messages in thread
From: Miguel Ojeda @ 2026-04-03 10:06 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Luis Chamberlain, Petr Pavlu, Daniel Gomez, Sami Tolvanen,
Nathan Chancellor, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild, stable
On Tue, Mar 31, 2026 at 10:59 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Clippy in Rust 1.88.0 (only) reports [1]:
>
> warning: variables can be used directly in the `format!` string
> --> rust/macros/module.rs:112:23
> |
> 112 | let content = format!("{param}:{content}", param = param, content = content);
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> help: change this to
> |
> 112 - let content = format!("{param}:{content}", param = param, content = content);
> 112 + let content = format!("{param}:{content}");
>
> warning: variables can be used directly in the `format!` string
> --> rust/macros/module.rs:198:14
> |
> 198 | t => panic!("Unsupported parameter type {}", t),
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> help: change this to
> |
> 198 - t => panic!("Unsupported parameter type {}", t),
> 198 + t => panic!("Unsupported parameter type {t}"),
> |
>
> The reason it only triggers in that version is that the lint was moved
> from `pedantic` to `style` in Rust 1.88.0 and then back to `pedantic`
> in Rust 1.89.0 [2][3].
>
> In the first case, the suggestion is fair and a pure simplification, thus
> we will clean it up separately.
>
> To keep the behavior the same across all versions, and since the lint
> does not work for all macros (e.g. custom ones like `pr_info!`), disable
> it globally.
>
> Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
> Link: https://lore.kernel.org/rust-for-linux/CANiq72=drAtf3y_DZ-2o4jb6Az9J3Yj4QYwWnbRui4sm4AJD3Q@mail.gmail.com/ [1]
> Link: https://github.com/rust-lang/rust-clippy/pull/15287 [2]
> Link: https://github.com/rust-lang/rust-clippy/issues/15151 [3]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Applied series to `rust-next` -- thanks everyone!
(If wanted by modules, I can drop the top commit.)
Cheers,
Miguel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
2026-03-31 20:58 [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Miguel Ojeda
` (2 preceding siblings ...)
2026-04-03 10:06 ` Miguel Ojeda
@ 2026-04-03 10:24 ` Tamir Duberstein
2026-04-03 13:07 ` Miguel Ojeda
3 siblings, 1 reply; 14+ messages in thread
From: Tamir Duberstein @ 2026-04-03 10:24 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Luis Chamberlain, Petr Pavlu, Daniel Gomez, Sami Tolvanen,
Nathan Chancellor, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild, stable
On Tue, Mar 31, 2026 at 4:59 PM Miguel Ojeda <ojeda@kernel.org> wrote:
>
> Clippy in Rust 1.88.0 (only) reports [1]:
>
> warning: variables can be used directly in the `format!` string
> --> rust/macros/module.rs:112:23
> |
> 112 | let content = format!("{param}:{content}", param = param, content = content);
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> help: change this to
> |
> 112 - let content = format!("{param}:{content}", param = param, content = content);
> 112 + let content = format!("{param}:{content}");
>
> warning: variables can be used directly in the `format!` string
> --> rust/macros/module.rs:198:14
> |
> 198 | t => panic!("Unsupported parameter type {}", t),
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> |
> = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> help: change this to
> |
> 198 - t => panic!("Unsupported parameter type {}", t),
> 198 + t => panic!("Unsupported parameter type {t}"),
> |
>
> The reason it only triggers in that version is that the lint was moved
> from `pedantic` to `style` in Rust 1.88.0 and then back to `pedantic`
> in Rust 1.89.0 [2][3].
>
> In the first case, the suggestion is fair and a pure simplification, thus
> we will clean it up separately.
>
> To keep the behavior the same across all versions, and since the lint
> does not work for all macros (e.g. custom ones like `pr_info!`), disable
> it globally.
Seeing this patch a bit late but in clippy 1.85.0 there is
`#[clippy::format_args]` which would permit us to make the lint work
with our custom macros.
https://doc.rust-lang.org/nightly/clippy/attribs.html#clippyformat_args
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`
2026-04-03 10:24 ` Tamir Duberstein
@ 2026-04-03 13:07 ` Miguel Ojeda
0 siblings, 0 replies; 14+ messages in thread
From: Miguel Ojeda @ 2026-04-03 13:07 UTC (permalink / raw)
To: Tamir Duberstein
Cc: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Sami Tolvanen, Nathan Chancellor, Nicolas Schier, Boqun Feng,
Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg,
Alice Ryhl, Trevor Gross, Danilo Krummrich, rust-for-linux,
Aaron Tomlin, linux-modules, linux-kernel, linux-kbuild, stable
On Fri, Apr 3, 2026 at 12:25 PM Tamir Duberstein <tamird@kernel.org> wrote:
>
> Seeing this patch a bit late but in clippy 1.85.0 there is
> `#[clippy::format_args]` which would permit us to make the lint work
> with our custom macros.
+1, that may be good to consider, especially with the bump -- added
and backlinked in:
https://github.com/Rust-for-Linux/linux/issues/349
Maybe an issue would be good to create too.
It is good to see Clippy adding more attributes, because I requested a
similar one for other lints involving macros in that list, e.g.
https://github.com/rust-lang/rust-clippy/issues/11303
So hopefully we will eventually get those too.
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] rust: macros: simplify `format!` arguments
2026-04-03 4:53 ` Miguel Ojeda
@ 2026-04-03 15:52 ` Sami Tolvanen
2026-04-03 21:23 ` Miguel Ojeda
0 siblings, 1 reply; 14+ messages in thread
From: Sami Tolvanen @ 2026-04-03 15:52 UTC (permalink / raw)
To: Miguel Ojeda
Cc: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Nathan Chancellor, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild
Hi Miguel,
On Thu, Apr 2, 2026 at 9:53 PM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Tue, Mar 31, 2026 at 10:59 PM Miguel Ojeda <ojeda@kernel.org> wrote:
> >
> > Clippy in Rust 1.88.0 (only) reported [1] up to the previous commit:
> >
> > warning: variables can be used directly in the `format!` string
> > --> rust/macros/module.rs:112:23
> > |
> > 112 | let content = format!("{param}:{content}", param = param, content = content);
> > | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > |
> > = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
> > = note: `-W clippy::uninlined-format-args` implied by `-W clippy::all`
> > = help: to override `-W clippy::all` add `#[allow(clippy::uninlined_format_args)]`
> > help: change this to
> > |
> > 112 - let content = format!("{param}:{content}", param = param, content = content);
> > 112 + let content = format!("{param}:{content}");
> >
> > The reason it only triggers in that version is that the lint was moved
> > from `pedantic` to `style` in Rust 1.88.0 and then back to `pedantic`
> > in Rust 1.89.0 [2][3].
> >
> > In this case, the suggestion is fair and a pure simplification, thus
> > just apply it.
> >
> > In addition, do the same for another place in the file that Clippy does
> > not report because it is multi-line.
> >
> > Link: https://lore.kernel.org/rust-for-linux/CANiq72=drAtf3y_DZ-2o4jb6Az9J3Yj4QYwWnbRui4sm4AJD3Q@mail.gmail.com/ [1]
> > Link: https://github.com/rust-lang/rust-clippy/pull/15287 [2]
> > Link: https://github.com/rust-lang/rust-clippy/issues/15151 [3]
> > Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
>
> I will pick this one up together with the other one, but if someone
> prefers that I don't, please shout (e.g. if modules wants to pick it
> themselves).
Sounds good to me, thanks.
> An Acked-by is also appreciated, thanks!
Acked-by: Sami Tolvanen <samitolvanen@google.com>
Sami
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/2] rust: macros: simplify `format!` arguments
2026-04-03 15:52 ` Sami Tolvanen
@ 2026-04-03 21:23 ` Miguel Ojeda
0 siblings, 0 replies; 14+ messages in thread
From: Miguel Ojeda @ 2026-04-03 21:23 UTC (permalink / raw)
To: Sami Tolvanen
Cc: Miguel Ojeda, Luis Chamberlain, Petr Pavlu, Daniel Gomez,
Nathan Chancellor, Nicolas Schier, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, rust-for-linux, Aaron Tomlin,
linux-modules, linux-kernel, linux-kbuild
On Fri, Apr 3, 2026 at 5:53 PM Sami Tolvanen <samitolvanen@google.com> wrote:
>
> Sounds good to me, thanks.
>
> Acked-by: Sami Tolvanen <samitolvanen@google.com>
Great, I have added the tag now -- thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-04-03 21:24 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-31 20:58 [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Miguel Ojeda
2026-03-31 20:58 ` [PATCH 2/2] rust: macros: simplify `format!` arguments Miguel Ojeda
2026-03-31 21:07 ` Gary Guo
2026-04-03 4:53 ` Miguel Ojeda
2026-04-03 15:52 ` Sami Tolvanen
2026-04-03 21:23 ` Miguel Ojeda
2026-03-31 21:07 ` [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args` Gary Guo
2026-03-31 21:14 ` Miguel Ojeda
2026-03-31 21:43 ` Gary Guo
2026-03-31 21:53 ` Miguel Ojeda
2026-04-01 15:36 ` Gary Guo
2026-04-03 10:06 ` Miguel Ojeda
2026-04-03 10:24 ` Tamir Duberstein
2026-04-03 13:07 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox