Skip to content

Commit

Permalink
rust: std_vendor: simplify { .. macro! .. } with inner attributes
Browse files Browse the repository at this point in the history
It is cleaner to have a single inner attribute rather than needing
several hidden lines to wrap the macro invocations.

Thus simplify them.

Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Tested-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://lore.kernel.org/r/20240904204347.168520-20-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
ojeda committed Oct 3, 2024
1 parent 18598b9 commit 66f2ba8
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions rust/kernel/std_vendor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -84,7 +83,6 @@
/// }
///
/// dbg!(factorial(4));
/// # }
/// ```
///
/// This prints to the kernel log:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 66f2ba8

Please sign in to comment.