From nobody Sat Feb 7 14:39:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF873238D54; Fri, 2 May 2025 14:03:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194587; cv=none; b=E5AHPlASUU5rlfgj697W+277mdOgrclBNlwOmDT+Bhsqb8SFgT8yOsQhuFNdS5f9/YDEd6N1VIMgtyUDT739nnBTqbZNMSpX7o9nDCKW6MNHLJoP3/ELfEntTB/XorpJDwt6GzUvqDS2yHp6rKvXzv7jdTWOL/xkcn0isGnSy/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194587; c=relaxed/simple; bh=loBVhQtxMnHPpHQWrOwMbvIHRbUcRTPATJrFoQoljRk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Tnxk92aOUyIejF7kuCJM9Zcb121bik1MF6YdGcUh4FLFWdkj6Fa9w0HOLmN6lWvpWQy574tjhhpZ1LRc2OCtvM6OSKS4y2fJb/+44mLPQqxJBXhEzJUsmJAokw7GiGreyfh7dd8rPGi8QVUULxbpDAxmguTjTkVvHKagj3HwEOs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rfbHIUu3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rfbHIUu3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C80EAC4CEEE; Fri, 2 May 2025 14:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746194585; bh=loBVhQtxMnHPpHQWrOwMbvIHRbUcRTPATJrFoQoljRk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfbHIUu3MDdYXjpZMQd3JJ9F/Ni3TpciA38YgnqSmUfX9v9csHW4+XmvfYGZSubwX YA3iaU6JBxlD2XLnQNy9kxYPqHSW7foCgCkfu2zzGQ5NAt1UJqTFJeeIdVQeUUi/eG mTNtn2GT71xj1+I6kzHGAfTcENTPjf+Nm0hKWtCqwruCP55KxNWn4S88c1QtDeEvT7 XmlCPOJGt6pJK1JzYQvmVIZFvXstT3C07JBYqAZ2yNGP5c+VMWZRNb2SaygVUZlkOA 0Ux/WF+UG5HrlykiVnjVW3V9tJUrHSzpxEAmbgLSsg7CtsFntWbOJ1K+rv1SkwInpE V1WrxLPpEZm5A== From: Miguel Ojeda To: Miguel Ojeda , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, stable@vger.kernel.org, Josh Poimboeuf , Peter Zijlstra Subject: [PATCH 1/5] objtool/rust: add one more `noreturn` Rust function for Rust 1.87.0 Date: Fri, 2 May 2025 16:02:33 +0200 Message-ID: <20250502140237.1659624-2-ojeda@kernel.org> In-Reply-To: <20250502140237.1659624-1-ojeda@kernel.org> References: <20250502140237.1659624-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Starting with Rust 1.87.0 (expected 2025-05-15), `objtool` may report: rust/core.o: warning: objtool: _R..._4core9panicking9panic_fmt() falls through to next function _R..._4core9panicking18panic_nounwind_fmt() rust/core.o: warning: objtool: _R..._4core9panicking18panic_nounwind_fm= t() falls through to next function _R..._4core9panicking5panic() The reason is that `rust_begin_unwind` is now mangled: _R..._7___rustc17rust_begin_unwind Thus add the mangled one to the list so that `objtool` knows it is actually `noreturn`. See commit 56d680dd23c3 ("objtool/rust: list `noreturn` Rust functions") for more details. Alternatively, we could remove the fixed one in `noreturn.h` and relax this test to cover both, but it seems best to be strict as long as we can. Cc: stable@vger.kernel.org # Needed in 6.12.y and later (Rust is pinned in = older LTSs). Cc: Josh Poimboeuf Cc: Peter Zijlstra Signed-off-by: Miguel Ojeda Reviewed-by: Alice Ryhl --- tools/objtool/check.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 3a411064fa34..b21b12ec88d9 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -227,6 +227,7 @@ static bool is_rust_noreturn(const struct symbol *func) str_ends_with(func->name, "_4core9panicking19assert_failed_inner")= || str_ends_with(func->name, "_4core9panicking30panic_null_pointer_de= reference") || str_ends_with(func->name, "_4core9panicking36panic_misaligned_poin= ter_dereference") || + str_ends_with(func->name, "_7___rustc17rust_begin_unwind") || strstr(func->name, "_4core9panicking13assert_failed") || strstr(func->name, "_4core9panicking11panic_const24panic_const_") = || (strstr(func->name, "_4core5slice5index24slice_") && -- 2.49.0 From nobody Sat Feb 7 14:39:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC914238D54; Fri, 2 May 2025 14:03:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194591; cv=none; b=E104c5Qzu3nohXXWqrwvU5I2nz/MqhMWazqmQDLHuR5CbsfqxPCsPCiBk5U8iPvXO4M8XDfxo0nDLrVqJ5Rpx4wdJwFNiZWd99PACh1lx4IG1Z0LsFznbTHHxNWtSaxVDR5juscDJGq+7bkOirWuOVUa2YGpBD7VQjJW6/r/M1k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194591; c=relaxed/simple; bh=7qEfl7i6phNDc2ffZvUO+dFPf0BJE9OWp+T3HFvCE4o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OX4+dHr27+Icm277cSiG7eyRwdkmPqeUMQfBkV097ZJuodLWZHBv8NmWUOzD2cE5h+m8TbDhpGKtFXSnhPF00bC2SDDciCdDg1+SxpPdSL4k7idklucCoRWaL9ChQPwxaAV+gZsMbPBybfjfX9Jd9prVug5N0WydUuUN55kmiSY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BPWHu7rn; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BPWHu7rn" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB12BC4CEE4; Fri, 2 May 2025 14:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746194589; bh=7qEfl7i6phNDc2ffZvUO+dFPf0BJE9OWp+T3HFvCE4o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BPWHu7rngB2GoE8ZwgH0igniUJskEjqy++nPBCLFmLu1bWaapv3hHzFq/0W4+N5LW TvKqEYHNFhPMDI4VFGuGnXvBxWP+gRqJHg1yvX0TSlgJJKwfk/5OJd2naZ6UQYc9xU bJ7QwVGQ8S+UNrRaiJeJ7GR2hTJNFZVd1DqRte2QUk5+TXVrm0BLVqzO3WYiDEGqu4 agzKkIez9NO62vNdea+OgIVH5x3mQySCmUE0h9ITyqm07ctvRFSF7whcZ+MaRlJN7/ SSq6i85brs1/ZpApBbwMx/3+AOzN8TBpoc7KUxqJAKEyqRi9gNFhT+cMgOOP96Aw75 N+rC8BT+TIFtw== From: Miguel Ojeda To: Miguel Ojeda , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, stable@vger.kernel.org Subject: [PATCH 2/5] rust: clean Rust 1.87.0's `clippy::ptr_eq` lints Date: Fri, 2 May 2025 16:02:34 +0200 Message-ID: <20250502140237.1659624-3-ojeda@kernel.org> In-Reply-To: <20250502140237.1659624-1-ojeda@kernel.org> References: <20250502140237.1659624-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Starting with Rust 1.87.0 (expected 2025-05-15) [1], Clippy may expand the `ptr_eq` lint, e.g.: error: use `core::ptr::eq` when comparing raw pointers --> rust/kernel/list.rs:438:12 | 438 | if self.first =3D=3D item { | ^^^^^^^^^^^^^^^^^^ help: try: `core::ptr::eq(self.firs= t, item)` | =3D help: for further information visit https://rust-lang.github.io= /rust-clippy/master/index.html#ptr_eq =3D note: `-D clippy::ptr-eq` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(clippy::ptr_eq)]` Thus clean the few cases we have. This patch may not be actually needed by the time Rust 1.87.0 releases since a PR to relax the lint has been beta nominated [2] due to reports of being too eager (at least by default) [3]. 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/14339 [1] Link: https://github.com/rust-lang/rust-clippy/pull/14526 [2] Link: https://github.com/rust-lang/rust-clippy/issues/14525 [3] Signed-off-by: Miguel Ojeda Reviewed-by: Alice Ryhl --- rust/kernel/alloc/kvec.rs | 2 +- rust/kernel/list.rs | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rust/kernel/alloc/kvec.rs b/rust/kernel/alloc/kvec.rs index ae9d072741ce..cde911551327 100644 --- a/rust/kernel/alloc/kvec.rs +++ b/rust/kernel/alloc/kvec.rs @@ -743,7 +743,7 @@ fn into_raw_parts(self) -> (*mut T, NonNull, usize, = usize) { pub fn collect(self, flags: Flags) -> Vec { let old_layout =3D self.layout; let (mut ptr, buf, len, mut cap) =3D self.into_raw_parts(); - let has_advanced =3D ptr !=3D buf.as_ptr(); + let has_advanced =3D !core::ptr::eq(ptr, buf.as_ptr()); =20 if has_advanced { // Copy the contents we have advanced to at the beginning of t= he buffer. diff --git a/rust/kernel/list.rs b/rust/kernel/list.rs index a335c3b1ff5e..c63cbeee3316 100644 --- a/rust/kernel/list.rs +++ b/rust/kernel/list.rs @@ -435,7 +435,7 @@ unsafe fn remove_internal_inner( // * If `item` was the only item in the list, then `prev =3D=3D i= tem`, and we just set // `item->next` to null, so this correctly sets `first` to null= now that the list is // empty. - if self.first =3D=3D item { + if core::ptr::eq(self.first, item) { // SAFETY: The `prev` pointer is the value that `item->prev` h= ad when it was in this // list, so it must be valid. There is no race since `prev` is= still in the list and we // still have exclusive access to the list. @@ -556,7 +556,7 @@ fn next(&mut self) -> Option> { let next =3D unsafe { (*current).next }; // INVARIANT: If `current` was the last element of the list, then = this updates it to null. // Otherwise, we update it to the next element. - self.current =3D if next !=3D self.stop { + self.current =3D if !core::ptr::eq(next, self.stop) { next } else { ptr::null_mut() @@ -726,7 +726,7 @@ impl<'a, T: ?Sized + ListItem, const ID: u64> Curso= r<'a, T, ID> { fn prev_ptr(&self) -> *mut ListLinksFields { let mut next =3D self.next; let first =3D self.list.first; - if next =3D=3D first { + if core::ptr::eq(next, first) { // We are before the first element. return core::ptr::null_mut(); } @@ -788,7 +788,7 @@ pub fn move_next(&mut self) -> bool { // access the `next` field. let mut next =3D unsafe { (*self.next).next }; =20 - if next =3D=3D self.list.first { + if core::ptr::eq(next, self.list.first) { next =3D core::ptr::null_mut(); } =20 @@ -802,7 +802,7 @@ pub fn move_next(&mut self) -> bool { /// If the cursor is before the first element, then this call does not= hing. This call returns /// `true` if the cursor's position was changed. pub fn move_prev(&mut self) -> bool { - if self.next =3D=3D self.list.first { + if core::ptr::eq(self.next, self.list.first) { return false; } =20 @@ -822,7 +822,7 @@ fn insert_inner(&mut self, item: ListArc) -> *mu= t ListLinksFields { // * `ptr` is an element in the list or null. // * if `ptr` is null, then `self.list.first` is null so the list = is empty. let item =3D unsafe { self.list.insert_inner(item, ptr) }; - if self.next =3D=3D self.list.first { + if core::ptr::eq(self.next, self.list.first) { // INVARIANT: We just inserted `item`, so it's a member of lis= t. self.list.first =3D item; } --=20 2.49.0 From nobody Sat Feb 7 14:39:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BB5A256C9D; Fri, 2 May 2025 14:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194593; cv=none; b=CaaYq4ziJ6a5YgFEJLMYH6ALaIE5R+JtYZbd3v5tDuAa7alSjaTw0JcMvJifzg1qieH79MwOMWkE6Y0dTJoZtKC2LWmxF7WxpELqXVlVDKKGTYaBcYSh8sOZwKlEZa6jlDGQFpYRwURuPsvnMh2lS/VG0tLaO1vM8ckOxbJQbHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194593; c=relaxed/simple; bh=rrnV+01T0+qPAKcB4Oo8Wm9xDzxUTNA9dV6DF4q3AcI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FSvZRfaCCvV9Q3w/lABZq7+YiAyCJMm7JWOBszGE2p8MQDs6a5EEMtoK1HVsOwh2y9VL9Wng4MLQUOiNJyQB2UVVL4IJOhAcNw3c5qoO9SMAyFhH5uENcOXIrvYEZjL11ZXzoKG2cxzkwHvu7hOn/hfYWHwZJRYxgZjiQrgrFsQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qp0QSRIo; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qp0QSRIo" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF059C4CEEE; Fri, 2 May 2025 14:03:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746194593; bh=rrnV+01T0+qPAKcB4Oo8Wm9xDzxUTNA9dV6DF4q3AcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qp0QSRIomAvKJbz+U5LCvGYCyU01BuMGu3kqGdK1A4+4bmZyu9GlSOh+wKfVTfJ5M F/8lu7NqNVHB02N/VHVr+0JB0dc1O9AFH/exMehPZ4R2Km5eD1uTKrsODTH1KKKhIA lyOsH8hppjF0o6RX/h5a7kKN9AxJqZj5zyYCSJrZkNnUV9DLLwqk5o8dW5bt5ThFW9 BofecH5FtLViHgdCpwPXK2G23yeJ9/rgiNUfnRZGiZ5LYH1pXxbYZTXkcajM9vRhNH 0NXg4qQk7JggluSY6yMIj3Uvx2BBy7vFbCG1xVAryQqKQzt5b63qFCVOU4n61TFvjX emBDq/TryySKw== From: Miguel Ojeda To: Miguel Ojeda , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, stable@vger.kernel.org Subject: [PATCH 3/5] rust: clean Rust 1.88.0's `unnecessary_transmutes` lint Date: Fri, 2 May 2025 16:02:35 +0200 Message-ID: <20250502140237.1659624-4-ojeda@kernel.org> In-Reply-To: <20250502140237.1659624-1-ojeda@kernel.org> References: <20250502140237.1659624-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Starting with Rust 1.88.0 (expected 2025-06-26) [1][2], `rustc` may introduce a new lint that catches unnecessary transmutes, e.g.: error: unnecessary transmute --> rust/uapi/uapi_generated.rs:23242:18 | 23242 | unsafe { ::core::mem::transmute(self._bitfield_1.get(0u= size, 1u8) as u8) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^^^^^^^^^^^^^^^^^ help: replace this with: `(self._bitfield_1.get(0usize, 1= u8) as u8 =3D=3D 1)` | =3D note: `-D unnecessary-transmutes` implied by `-D warnings` =3D help: to override `-D warnings` add `#[allow(unnecessary_tran= smutes)]` There are a lot of them (at least 300), but luckily they are all in `bindgen`-generated code. Thus clean all up by allowing it there. Since unknown lints trigger a lint itself in older compilers, do it conditionally so that we can keep the `unknown_lints` lint enabled. 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/pull/136083 [1] Link: https://github.com/rust-lang/rust/issues/136067 [2] Signed-off-by: Miguel Ojeda Reviewed-by: Alice Ryhl --- init/Kconfig | 3 +++ rust/bindings/lib.rs | 1 + rust/uapi/lib.rs | 1 + 3 files changed, 5 insertions(+) diff --git a/init/Kconfig b/init/Kconfig index 63f5974b9fa6..4cdd1049283c 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -140,6 +140,9 @@ config LD_CAN_USE_KEEP_IN_OVERLAY config RUSTC_HAS_COERCE_POINTEE def_bool RUSTC_VERSION >=3D 108400 =20 +config RUSTC_HAS_UNNECESSARY_TRANSMUTES + def_bool RUSTC_VERSION >=3D 108800 + config PAHOLE_VERSION int default $(shell,$(srctree)/scripts/pahole-version.sh $(PAHOLE)) diff --git a/rust/bindings/lib.rs b/rust/bindings/lib.rs index 014af0d1fc70..a08eb5518cac 100644 --- a/rust/bindings/lib.rs +++ b/rust/bindings/lib.rs @@ -26,6 +26,7 @@ =20 #[allow(dead_code)] #[allow(clippy::undocumented_unsafe_blocks)] +#[cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_tran= smutes))] mod bindings_raw { // Manual definition for blocklisted types. type __kernel_size_t =3D usize; diff --git a/rust/uapi/lib.rs b/rust/uapi/lib.rs index 13495910271f..c98d7a8cde77 100644 --- a/rust/uapi/lib.rs +++ b/rust/uapi/lib.rs @@ -24,6 +24,7 @@ unreachable_pub, unsafe_op_in_unsafe_fn )] +#![cfg_attr(CONFIG_RUSTC_HAS_UNNECESSARY_TRANSMUTES, allow(unnecessary_tra= nsmutes))] =20 // Manual definition of blocklisted types. type __kernel_size_t =3D usize; --=20 2.49.0 From nobody Sat Feb 7 14:39:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43BF32561D6; Fri, 2 May 2025 14:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194599; cv=none; b=uoHwv3Y5InZLgfUNWW/l5b3DIL4B6g1Q1zHIG/wsWGwL/6uTCtiX+Avjso7ZeTtRFNMojt89aD0qxPQLXwDoI9ebgIIxMUWkJ4Rc49fH9nN7ETsGLXxAVCg2MPau5TT282aIFwcfiBgCGf7FE4o7p9RYUxSzx0NtK3kTiX4BkRQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194599; c=relaxed/simple; bh=JcmBhEUrvfaH96FSKF0m0KRLP7jLR6gEc4dpoEbdEt0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MQvV7N6qk1gRrOez3zP3QgQRPLGaQoJMDy9yomuRpxOuPal1W5BoTQaTntd8tt5wU3BT3X2LhXdjaL8gaO15dEKoYNR6QhIkr5lo8lH7Z62/rpLN10GkXv0ZoAsiI3bMZoqORNTGQhrWO/Z4tdDuIXS6DmHgpSLHv4H+p9c8pjg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=inN3AMId; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="inN3AMId" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EA56C4CEEB; Fri, 2 May 2025 14:03:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746194596; bh=JcmBhEUrvfaH96FSKF0m0KRLP7jLR6gEc4dpoEbdEt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=inN3AMIdb/IvUq7c5JYjEEcJjZ4YJZtQZNjXxcAYlOxOM9xu2aeLGlpsD5nSDenGF 4AMtdAweIx6EMTDD2Ii4WaP8m/pC7hqExaara4Yvh9+/tOGwvcSXHhgVwGn/1LQdOn Iz/b8LINQOCO+9YGWO+/4kaLuSqL/2hRLu7rvhPtjRMb8KoEzgO7ZD22BUWnCt7UHh V/PRX9oU1uVdvT8Kxy8F+l3JOokHLiLIjyxMkTczVmOGck6i/nL2x5KN9QdG1SdeH9 2M+JoHM5+Cfs91jk1mDWZ0z6/Ys9DpRBJJHHsSUlGsrbMu51LDo7qf6nwqFqW6LN0v DC4bpSveSTl0w== From: Miguel Ojeda To: Miguel Ojeda , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, stable@vger.kernel.org Subject: [PATCH 4/5] rust: clean Rust 1.88.0's warning about `clippy::disallowed_macros` configuration Date: Fri, 2 May 2025 16:02:36 +0200 Message-ID: <20250502140237.1659624-5-ojeda@kernel.org> In-Reply-To: <20250502140237.1659624-1-ojeda@kernel.org> References: <20250502140237.1659624-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Starting with Rust 1.88.0 (expected 2025-06-26) [1], Clippy may start warning about paths that do not resolve in the `disallowed_macros` configuration: warning: `kernel::dbg` does not refer to an existing macro --> .clippy.toml:10:5 | 10 | { path =3D "kernel::dbg", reason =3D "the `dbg!` macro is inte= nded as a debugging tool" }, | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^^^^^^^^^^^^^^^^^^^^^^^ This is a lint we requested at [2], due to the trouble debugging the lint due to false negatives (e.g. [3]), which we use to emulate `clippy::dbg_macro` [4]. See commit 8577c9dca799 ("rust: replace `clippy::dbg_macro` with `disallowed_macros`") for more details. Given the false negatives are not resolved yet, it is expected that Clippy complains about not finding this macro. Thus, until the false negatives are fixed (and, even then, probably we will need to wait for the MSRV to raise enough), use the escape hatch to allow an invalid path. 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/14397 [1] Link: https://github.com/rust-lang/rust-clippy/issues/11432 [2] Link: https://github.com/rust-lang/rust-clippy/issues/11431 [3] Link: https://github.com/rust-lang/rust-clippy/issues/11303 [4] Signed-off-by: Miguel Ojeda Reviewed-by: Alice Ryhl --- .clippy.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.clippy.toml b/.clippy.toml index 815c94732ed7..137f41d203de 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -7,5 +7,5 @@ check-private-items =3D true disallowed-macros =3D [ # The `clippy::dbg_macro` lint only works with `std::dbg!`, thus we si= mulate # it here, see: https://github.com/rust-lang/rust-clippy/issues/11303. - { path =3D "kernel::dbg", reason =3D "the `dbg!` macro is intended as = a debugging tool" }, + { path =3D "kernel::dbg", reason =3D "the `dbg!` macro is intended as = a debugging tool", allow-invalid =3D true }, ] --=20 2.49.0 From nobody Sat Feb 7 14:39:24 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87BDB257427; Fri, 2 May 2025 14:03:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194600; cv=none; b=jS1xOEQf0D48x965SzuCnbu4uRMmR1utrveKlbkJvzScGWKwFYAzNRXRUgQuek8pjnggTOwkRzuPuZ9/GGQNb1ZcF4ySZYu8yOLP++wtCtFj7Bb/Ph21Evk+TKCxBdOrs0MT0vTEE5aRR1IlM+huAOOHepaB7JK/Rrtc3YLJtTQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746194600; c=relaxed/simple; bh=5hjxujVq9UNEKFrCpRJWHAmcCo5XnfoXNdbzgUPep2I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uGCqqbfzpt9K5aUFbWri7o9nIbWSv5foQIvmyUoE7lTe7qpM08D2hnikroFoEunWEO1ljrMsZ+6MCd5BytICZO2YBCfzNoSkUvWlVwdQIYJwFx4VMpu9dKOqOl050MdoAkhcp5XEI5zQypfjZGvRxhbOu5EGlWwzDIMbKzdf21I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KhmTD0+3; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KhmTD0+3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36FAEC4CEE4; Fri, 2 May 2025 14:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1746194600; bh=5hjxujVq9UNEKFrCpRJWHAmcCo5XnfoXNdbzgUPep2I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KhmTD0+3p83k5lNd4vW8hDNYkrRd4BRw1MxgihTtFzyY3ubnGf2J3Jdmogppkx3qn Z29LHUwlRRR1Er6x8oocBDW20TcQE0fbYKnPfDVXnefw1vS5ncBxkbFcJreyfKwEtj IzI9orUg/KTKAZ6s7Hx9QcisDJ2hd/irnq97yzU+SKPZpsJ2a6Q8IPluwweOI/7ymn WsDAsqa3/OBdfgQMZx3+SvTXIYCiYPVhzacEWd3aNEPxxLFBkCSi7bjRIKVwFJhrRH Kt8YfJZ1EREKj8GXe+TYwD6oQdaVCg1soItmNm8cG2QWhQjkvsuC5RlwgdUh0P6ItN l1Gtc/P7E29Eg== From: Miguel Ojeda To: Miguel Ojeda , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, stable@vger.kernel.org Subject: [PATCH 5/5] rust: clean Rust 1.88.0's `clippy::uninlined_format_args` lint Date: Fri, 2 May 2025 16:02:37 +0200 Message-ID: <20250502140237.1659624-6-ojeda@kernel.org> In-Reply-To: <20250502140237.1659624-1-ojeda@kernel.org> References: <20250502140237.1659624-1-ojeda@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 =3D format!("kunit_rust_wrapper= _{}", test); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^^^^^^^^^ | =3D 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 =3D format!("kunit_rust_wrapper= _{}", test); 105 + let kunit_wrapper_fn_name =3D 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}=3D{content}\0", field =3D field, cont= ent =3D content) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^= ^^^^^^^^^^ | =3D 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}=3D{content}\0", field =3D field, cont= ent =3D content) 51 + format!("{field}=3D{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 Link: https://github.com/rust-lang/rust-clippy/pull/14160 [1] Signed-off-by: Miguel Ojeda Acked-by: Benno Lossin Reviewed-by: Alice Ryhl Reviewed-by: Tamir Duberstein --- 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(-) diff --git a/drivers/gpu/nova-core/gpu.rs b/drivers/gpu/nova-core/gpu.rs index 17c9660da450..ab0e5a72a059 100644 --- a/drivers/gpu/nova-core/gpu.rs +++ b/drivers/gpu/nova-core/gpu.rs @@ -93,7 +93,7 @@ pub(crate) fn arch(&self) -> Architecture { // For now, redirect to fmt::Debug for convenience. impl fmt::Display for Chipset { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:?}", self) + write!(f, "{self:?}") } } diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index 878111cb77bc..fb61ce81ea28 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -73,7 +73,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { b'\r' =3D> f.write_str("\\r")?, // Printable characters. 0x20..=3D0x7e =3D> f.write_char(b as char)?, - _ =3D> write!(f, "\\x{:02x}", b)?, + _ =3D> write!(f, "\\x{b:02x}")?, } } Ok(()) @@ -109,7 +109,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Resul= t { b'\\' =3D> f.write_str("\\\\")?, // Printable characters. 0x20..=3D0x7e =3D> f.write_char(b as char)?, - _ =3D> write!(f, "\\x{:02x}", b)?, + _ =3D> write!(f, "\\x{b:02x}")?, } } f.write_char('"') @@ -447,7 +447,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Resul= t { // Printable character. f.write_char(c as char)?; } else { - write!(f, "\\x{:02x}", c)?; + write!(f, "\\x{c:02x}")?; } } Ok(()) @@ -479,7 +479,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Resul= t { // Printable characters. b'\"' =3D> f.write_str("\\\"")?, 0x20..=3D0x7e =3D> f.write_char(c as char)?, - _ =3D> write!(f, "\\x{:02x}", c)?, + _ =3D> write!(f, "\\x{c:02x}")?, } } f.write_str("\"") @@ -641,13 +641,13 @@ fn test_cstr_as_str_unchecked() { #[test] fn test_cstr_display() { let hello_world =3D CStr::from_bytes_with_nul(b"hello, world!\0").= unwrap(); - assert_eq!(format!("{}", hello_world), "hello, world!"); + assert_eq!(format!("{hello_world}"), "hello, world!"); let non_printables =3D CStr::from_bytes_with_nul(b"\x01\x09\x0a\0"= ).unwrap(); - assert_eq!(format!("{}", non_printables), "\\x01\\x09\\x0a"); + assert_eq!(format!("{non_printables}"), "\\x01\\x09\\x0a"); let non_ascii =3D CStr::from_bytes_with_nul(b"d\xe9j\xe0 vu\0").un= wrap(); - assert_eq!(format!("{}", non_ascii), "d\\xe9j\\xe0 vu"); + assert_eq!(format!("{non_ascii}"), "d\\xe9j\\xe0 vu"); let good_bytes =3D CStr::from_bytes_with_nul(b"\xf0\x9f\xa6\x80\0"= ).unwrap(); - assert_eq!(format!("{}", good_bytes), "\\xf0\\x9f\\xa6\\x80"); + assert_eq!(format!("{good_bytes}"), "\\xf0\\x9f\\xa6\\x80"); } #[test] @@ -658,47 +658,47 @@ fn test_cstr_display_all_bytes() { bytes[i as usize] =3D i.wrapping_add(1); } let cstr =3D CStr::from_bytes_with_nul(&bytes).unwrap(); - assert_eq!(format!("{}", cstr), ALL_ASCII_CHARS); + assert_eq!(format!("{cstr}"), ALL_ASCII_CHARS); } #[test] fn test_cstr_debug() { let hello_world =3D CStr::from_bytes_with_nul(b"hello, world!\0").= unwrap(); - assert_eq!(format!("{:?}", hello_world), "\"hello, world!\""); + assert_eq!(format!("{hello_world:?}"), "\"hello, world!\""); let non_printables =3D CStr::from_bytes_with_nul(b"\x01\x09\x0a\0"= ).unwrap(); - assert_eq!(format!("{:?}", non_printables), "\"\\x01\\x09\\x0a\""); + assert_eq!(format!("{non_printables:?}"), "\"\\x01\\x09\\x0a\""); let non_ascii =3D CStr::from_bytes_with_nul(b"d\xe9j\xe0 vu\0").un= wrap(); - assert_eq!(format!("{:?}", non_ascii), "\"d\\xe9j\\xe0 vu\""); + assert_eq!(format!("{non_ascii:?}"), "\"d\\xe9j\\xe0 vu\""); let good_bytes =3D CStr::from_bytes_with_nul(b"\xf0\x9f\xa6\x80\0"= ).unwrap(); - assert_eq!(format!("{:?}", good_bytes), "\"\\xf0\\x9f\\xa6\\x80\""= ); + assert_eq!(format!("{good_bytes:?}"), "\"\\xf0\\x9f\\xa6\\x80\""); } #[test] fn test_bstr_display() { let hello_world =3D BStr::from_bytes(b"hello, world!"); - assert_eq!(format!("{}", hello_world), "hello, world!"); + assert_eq!(format!("{hello_world}"), "hello, world!"); let escapes =3D BStr::from_bytes(b"_\t_\n_\r_\\_\'_\"_"); - assert_eq!(format!("{}", escapes), "_\\t_\\n_\\r_\\_'_\"_"); + assert_eq!(format!("{escapes}"), "_\\t_\\n_\\r_\\_'_\"_"); let others =3D BStr::from_bytes(b"\x01"); - assert_eq!(format!("{}", others), "\\x01"); + assert_eq!(format!("{others}"), "\\x01"); let non_ascii =3D BStr::from_bytes(b"d\xe9j\xe0 vu"); - assert_eq!(format!("{}", non_ascii), "d\\xe9j\\xe0 vu"); + assert_eq!(format!("{non_ascii}"), "d\\xe9j\\xe0 vu"); let good_bytes =3D BStr::from_bytes(b"\xf0\x9f\xa6\x80"); - assert_eq!(format!("{}", good_bytes), "\\xf0\\x9f\\xa6\\x80"); + assert_eq!(format!("{good_bytes}"), "\\xf0\\x9f\\xa6\\x80"); } #[test] fn test_bstr_debug() { let hello_world =3D BStr::from_bytes(b"hello, world!"); - assert_eq!(format!("{:?}", hello_world), "\"hello, world!\""); + assert_eq!(format!("{hello_world:?}"), "\"hello, world!\""); let escapes =3D BStr::from_bytes(b"_\t_\n_\r_\\_\'_\"_"); - assert_eq!(format!("{:?}", escapes), "\"_\\t_\\n_\\r_\\\\_'_\\\"_\= ""); + assert_eq!(format!("{escapes:?}"), "\"_\\t_\\n_\\r_\\\\_'_\\\"_\""= ); let others =3D BStr::from_bytes(b"\x01"); - assert_eq!(format!("{:?}", others), "\"\\x01\""); + assert_eq!(format!("{others:?}"), "\"\\x01\""); let non_ascii =3D BStr::from_bytes(b"d\xe9j\xe0 vu"); - assert_eq!(format!("{:?}", non_ascii), "\"d\\xe9j\\xe0 vu\""); + assert_eq!(format!("{non_ascii:?}"), "\"d\\xe9j\\xe0 vu\""); let good_bytes =3D BStr::from_bytes(b"\xf0\x9f\xa6\x80"); - assert_eq!(format!("{:?}", good_bytes), "\"\\xf0\\x9f\\xa6\\x80\""= ); + assert_eq!(format!("{good_bytes:?}"), "\"\\xf0\\x9f\\xa6\\x80\""); } } diff --git a/rust/macros/kunit.rs b/rust/macros/kunit.rs index 4f553ecf40c0..99ccac82edde 100644 --- a/rust/macros/kunit.rs +++ b/rust/macros/kunit.rs @@ -15,10 +15,7 @@ pub(crate) fn kunit_tests(attr: TokenStream, ts: TokenSt= ream) -> TokenStream { } if attr.len() > 255 { - panic!( - "The test suite name `{}` exceeds the maximum length of 255 by= tes", - attr - ) + panic!("The test suite name `{attr}` exceeds the maximum length of= 255 bytes") } let mut tokens: Vec<_> =3D ts.into_iter().collect(); @@ -102,16 +99,14 @@ pub(crate) fn kunit_tests(attr: TokenStream, ts: Token= Stream) -> TokenStream { let mut kunit_macros =3D "".to_owned(); let mut test_cases =3D "".to_owned(); for test in &tests { - let kunit_wrapper_fn_name =3D format!("kunit_rust_wrapper_{}", tes= t); + let kunit_wrapper_fn_name =3D format!("kunit_rust_wrapper_{test}"); let kunit_wrapper =3D format!( - "unsafe extern \"C\" fn {}(_test: *mut kernel::bindings::kunit= ) {{ {}(); }}", - kunit_wrapper_fn_name, test + "unsafe extern \"C\" fn {kunit_wrapper_fn_name}(_test: *mut ke= rnel::bindings::kunit) {{ {test}(); }}" ); writeln!(kunit_macros, "{kunit_wrapper}").unwrap(); writeln!( test_cases, - " kernel::kunit::kunit_case(kernel::c_str!(\"{}\"), {}),", - test, kunit_wrapper_fn_name + " kernel::kunit::kunit_case(kernel::c_str!(\"{test}\"), {ku= nit_wrapper_fn_name})," ) .unwrap(); } diff --git a/rust/macros/module.rs b/rust/macros/module.rs index a9418fbc9b44..2f66107847f7 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -48,7 +48,7 @@ fn emit_base(&mut self, field: &str, content: &str, built= in: bool) { ) } else { // Loadable modules' modinfo strings go as-is. - format!("{field}=3D{content}\0", field =3D field, content =3D = content) + format!("{field}=3D{content}\0") }; write!( @@ -126,10 +126,7 @@ fn parse(it: &mut token_stream::IntoIter) -> Self { }; if seen_keys.contains(&key) { - panic!( - "Duplicated key \"{}\". Keys can only be specified onc= e.", - key - ); + panic!("Duplicated key \"{key}\". Keys can only be specifi= ed once."); } assert_eq!(expect_punct(it), ':'); @@ -143,10 +140,7 @@ fn parse(it: &mut token_stream::IntoIter) -> Self { "license" =3D> info.license =3D expect_string_ascii(it), "alias" =3D> info.alias =3D Some(expect_string_array(it)), "firmware" =3D> info.firmware =3D Some(expect_string_array= (it)), - _ =3D> panic!( - "Unknown key \"{}\". Valid keys are: {:?}.", - key, EXPECTED_KEYS - ), + _ =3D> panic!("Unknown key \"{key}\". Valid keys are: {EXP= ECTED_KEYS:?}."), } assert_eq!(expect_punct(it), ','); @@ -158,7 +152,7 @@ fn parse(it: &mut token_stream::IntoIter) -> Self { for key in REQUIRED_KEYS { if !seen_keys.iter().any(|e| e =3D=3D key) { - panic!("Missing required key \"{}\".", key); + panic!("Missing required key \"{key}\"."); } } @@ -170,10 +164,7 @@ fn parse(it: &mut token_stream::IntoIter) -> Self { } if seen_keys !=3D ordered_keys { - panic!( - "Keys are not ordered as expected. Order them like: {:?}.", - ordered_keys - ); + panic!("Keys are not ordered as expected. Order them like: {or= dered_keys:?}."); } info diff --git a/rust/macros/paste.rs b/rust/macros/paste.rs index 6529a387673f..cce712d19855 100644 --- a/rust/macros/paste.rs +++ b/rust/macros/paste.rs @@ -50,7 +50,7 @@ fn concat_helper(tokens: &[TokenTree]) -> Vec<(String, Sp= an)> { let tokens =3D group.stream().into_iter().collect::>(); segments.append(&mut concat_helper(tokens.as_slice())); } - token =3D> panic!("unexpected token in paste segments: {:?}", = token), + token =3D> panic!("unexpected token in paste segments: {token:= ?}"), }; } diff --git a/rust/pin-init/internal/src/pinned_drop.rs b/rust/pin-init/inte= rnal/src/pinned_drop.rs index c824dd8b436d..c4ca7a70b726 100644 --- a/rust/pin-init/internal/src/pinned_drop.rs +++ b/rust/pin-init/internal/src/pinned_drop.rs @@ -28,8 +28,7 @@ pub(crate) fn pinned_drop(_args: TokenStream, input: Toke= nStream) -> TokenStream // Found the end of the generics, this should be `PinnedDrop`. assert!( matches!(tt, TokenTree::Ident(i) if i.to_string() =3D=3D "= PinnedDrop"), - "expected 'PinnedDrop', found: '{:?}'", - tt + "expected 'PinnedDrop', found: '{tt:?}'" ); pinned_drop_idx =3D Some(i); break; -- 2.49.0