All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Benno Lossin" <lossin@kernel.org>
To: "Miguel Ojeda" <ojeda@kernel.org>, "Alex Gaynor" <alex.gaynor@gmail.com>
Cc: "Boqun Feng" <boqun.feng@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
	patches@lists.linux.dev, stable@vger.kernel.org
Subject: Re: [PATCH 5/5] rust: clean Rust 1.88.0's `clippy::uninlined_format_args` lint
Date: Fri, 02 May 2025 20:49:52 +0200	[thread overview]
Message-ID: <D9LWF31GZM92.JYBJGA8BHRZQ@kernel.org> (raw)
In-Reply-To: <20250502140237.1659624-6-ojeda@kernel.org>

On Fri May 2, 2025 at 4:02 PM CEST, Miguel Ojeda wrote:
> Starting with Rust 1.88.0 (expected 2025-06-26) [1], `rustc` may move
> back the `uninlined_format_args` to `style` from `pedantic` (it was
> there waiting for rust-analyzer suppotr), and thus we will start to see
> lints like:
>
>     warning: variables can be used directly in the `format!` string
>        --> rust/macros/kunit.rs:105:37
>         |
>     105 |         let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{}", test);
>         |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>         |
>         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
>     help: change this to
>         |
>     105 -         let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{}", test);
>     105 +         let kunit_wrapper_fn_name = format!("kunit_rust_wrapper_{test}");
>
> There is even a case that is a pure removal:
>
>     warning: variables can be used directly in the `format!` string
>       --> rust/macros/module.rs:51:13
>        |
>     51 |             format!("{field}={content}\0", field = field, content = content)
>        |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>        |
>        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
>     help: change this to
>        |
>     51 -             format!("{field}={content}\0", field = field, content = content)
>     51 +             format!("{field}={content}\0")
>
> The lints all seem like nice cleanups, thus just apply them.
>
> We may want to disable `allow-mixed-uninlined-format-args` in the future.
>
> Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in older LTSs).
> Cc: Benno Lossin <benno.lossin@proton.me>
> Link: https://github.com/rust-lang/rust-clippy/pull/14160 [1]
> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

For the pin-init modification: 

Acked-by: Benno Lossin <lossin@kernel.org>

---
Cheers,
Benno

> ---
>  drivers/gpu/nova-core/gpu.rs              |  2 +-
>  rust/kernel/str.rs                        | 46 +++++++++++------------
>  rust/macros/kunit.rs                      | 13 ++-----
>  rust/macros/module.rs                     | 19 +++-------
>  rust/macros/paste.rs                      |  2 +-
>  rust/pin-init/internal/src/pinned_drop.rs |  3 +-
>  6 files changed, 35 insertions(+), 50 deletions(-)

  parent reply	other threads:[~2025-05-02 18:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02 14:02 [PATCH 0/5] Rust beta (1.87) and nightly (1.88) lint cleanups Miguel Ojeda
2025-05-02 14:02 ` [PATCH 1/5] objtool/rust: add one more `noreturn` Rust function for Rust 1.87.0 Miguel Ojeda
2025-05-13 18:07   ` Joel Fernandes
2025-05-13 21:58     ` Joel Fernandes
2025-05-14  0:22       ` John Hubbard
2025-05-14  0:43         ` Timur Tabi
2025-05-14 14:52           ` Joel Fernandes
2025-05-14 19:14             ` Josh Poimboeuf
2025-05-14 19:46               ` Timur Tabi
2025-05-15 16:18                 ` Josh Poimboeuf
2025-05-15 19:06                   ` Timur Tabi
2025-05-15 21:12                     ` Kane York
2025-05-15 22:16                     ` Josh Poimboeuf
2025-05-15 22:22                       ` Timur Tabi
2025-05-20 19:49     ` Miguel Ojeda
2025-05-02 14:02 ` [PATCH 2/5] rust: clean Rust 1.87.0's `clippy::ptr_eq` lints Miguel Ojeda
2025-05-05  9:23   ` Alice Ryhl
2025-05-05 15:25     ` Miguel Ojeda
2025-05-02 14:02 ` [PATCH 3/5] rust: clean Rust 1.88.0's `unnecessary_transmutes` lint Miguel Ojeda
2025-05-02 14:02 ` [PATCH 4/5] rust: clean Rust 1.88.0's warning about `clippy::disallowed_macros` configuration Miguel Ojeda
2025-05-02 14:02 ` [PATCH 5/5] rust: clean Rust 1.88.0's `clippy::uninlined_format_args` lint Miguel Ojeda
2025-05-02 16:01   ` Tamir Duberstein
2025-05-02 18:49   ` Benno Lossin [this message]
2025-05-05  9:23 ` [PATCH 0/5] Rust beta (1.87) and nightly (1.88) lint cleanups Alice Ryhl
2025-05-06 22:22 ` Miguel Ojeda

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=D9LWF31GZM92.JYBJGA8BHRZQ@kernel.org \
    --to=lossin@kernel.org \
    --cc=a.hindborg@kernel.org \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=patches@lists.linux.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tmgross@umich.edu \
    /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.