linux-yocto/rust/kernel
Miguel Ojeda 6b0383a21d rust: clean Rust 1.88.0's clippy::uninlined_format_args lint
commit 211dcf77856db64c73e0c3b9ce0c624ec855daca upstream.

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).
Link: https://github.com/rust-lang/rust-clippy/pull/14160 [1]
Acked-by: Benno Lossin <lossin@kernel.org>
Reviewed-by: Tamir Duberstein <tamird@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20250502140237.1659624-6-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-05-18 08:24:57 +02:00
..
alloc rust: allow Rust 1.87.0's clippy::ptr_eq lint 2025-05-18 08:24:57 +02:00
block rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
init rust: init: add missing newline to pr_info! calls 2025-03-22 12:54:26 -07:00
list rust: start using the #[expect(...)] attribute 2025-03-13 13:01:42 +01:00
net rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
sync rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
alloc.rs rust: alloc: update module comment of alloc.rs 2025-03-13 13:01:47 +01:00
block.rs rust: block: introduce kernel::block::mq module 2024-06-14 07:45:04 -06:00
build_assert.rs rust: upgrade to Rust 1.68.2 2023-05-31 17:35:03 +02:00
device.rs rust: device: change the from_raw() function 2024-10-03 13:54:48 +02:00
error.rs rust: error: add missing newline to pr_warn! calls 2025-03-22 12:54:26 -07:00
firmware.rs rust: firmware: Use ffi::c_char type in FwFunc 2025-05-02 07:59:06 +02:00
init.rs rust: init: add missing newline to pr_info! calls 2025-03-22 12:54:26 -07:00
ioctl.rs rust: start using the #[expect(...)] attribute 2025-03-13 13:01:42 +01:00
kunit.rs rust: kunit: use C-string literals to clean warning 2024-10-01 23:46:42 +02:00
lib.rs rust: remove leftover mentions of the alloc crate 2025-03-22 12:54:23 -07:00
list.rs rust: allow Rust 1.87.0's clippy::ptr_eq lint 2025-05-18 08:24:57 +02:00
net.rs rust: core abstractions for network PHY drivers 2023-12-15 09:35:50 +00:00
page.rs rust: add abstraction for struct page 2024-07-08 23:44:01 +02:00
prelude.rs rust: alloc: add Vec to prelude 2025-03-13 13:01:46 +01:00
print.rs rust: fix signature of rust_fmt_argument 2025-04-10 14:39:20 +02:00
rbtree.rs rust: treewide: switch to our kernel Box type 2025-03-13 13:01:44 +01:00
sizes.rs rust: sizes: add commonly used constants 2024-08-30 10:27:34 +01:00
static_assert.rs rust: static_assert: add static_assert! macro 2022-12-04 01:59:16 +01:00
std_vendor.rs rust: start using the #[expect(...)] attribute 2025-03-13 13:01:42 +01:00
str.rs rust: clean Rust 1.88.0's clippy::uninlined_format_args lint 2025-05-18 08:24:57 +02:00
sync.rs rust: lockdep: Remove support for dynamically allocated LockClassKeys 2025-03-22 12:54:22 -07:00
task.rs rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
time.rs rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
types.rs rust: use custom FFI integer types 2025-03-13 13:01:49 +01:00
uaccess.rs rust: map long to isize and char to u8 2025-03-13 13:02:13 +01:00
workqueue.rs rust: treewide: switch to our kernel Box type 2025-03-13 13:01:44 +01:00