Re: [PATCH 1/2] kbuild: rust: allow `clippy::uninlined_format_args`

From: Tamir Duberstein

Date: Fri Apr 03 2026 - 06:25:43 EST


On Tue, Mar 31, 2026 at 4:59 PM Miguel Ojeda <ojeda@xxxxxxxxxx> 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