[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240904204347.168520-20-ojeda@kernel.org>
Date: Wed, 4 Sep 2024 22:43:47 +0200
From: Miguel Ojeda <ojeda@...nel.org>
To: Miguel Ojeda <ojeda@...nel.org>,
Alex Gaynor <alex.gaynor@...il.com>,
Wedson Almeida Filho <wedsonaf@...il.com>
Cc: Boqun Feng <boqun.feng@...il.com>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...sung.com>,
Alice Ryhl <aliceryhl@...gle.com>,
Trevor Gross <tmgross@...ch.edu>,
rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org,
patches@...ts.linux.dev
Subject: [PATCH 19/19] rust: std_vendor: simplify `{ .. macro! .. }` with inner attributes
It is cleaner to have a single inner attribute rather than needing
several hidden lines to wrap the macro invocations.
Thus simplify them.
Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
---
rust/kernel/std_vendor.rs | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/rust/kernel/std_vendor.rs b/rust/kernel/std_vendor.rs
index 8b4872b48e97..8f27d447a7fc 100644
--- a/rust/kernel/std_vendor.rs
+++ b/rust/kernel/std_vendor.rs
@@ -73,8 +73,7 @@
/// Naive factorial implementation:
///
/// ```rust
-/// # #[expect(clippy::disallowed_macros)]
-/// # {
+/// # #![expect(clippy::disallowed_macros)]
/// fn factorial(n: u32) -> u32 {
/// if dbg!(n <= 1) {
/// dbg!(1)
@@ -84,7 +83,6 @@
/// }
///
/// dbg!(factorial(4));
-/// # }
/// ```
///
/// This prints to the kernel log:
@@ -129,11 +127,9 @@
/// invocations. You can use a 1-tuple directly if you need one:
///
/// ```
-/// # #[expect(clippy::disallowed_macros)]
-/// # {
+/// # #![expect(clippy::disallowed_macros)]
/// assert_eq!(1, dbg!(1u32,)); // trailing comma ignored
/// assert_eq!((1,), dbg!((1u32,))); // 1-tuple
-/// # }
/// ```
///
/// [`std::dbg`]: https://doc.rust-lang.org/std/macro.dbg.html
--
2.46.0
Powered by blists - more mailing lists