From 3773da29f289a6c96e3a4e903288a7e479a0c6b8 Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Thu, 7 Sep 2023 08:24:06 -0700 Subject: [PATCH] [macros] safety_comment! permits multiple comments (#342) The following is now supported: safety_comment! { /// SAFETY: /// Safety comment here. macro_invocation!(); macro_invocation!(); /// Previously, this comment (which appears after macro /// invocations) was not supported. macro_invocation!(); macro_invocation!(); } --- src/macros.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/macros.rs b/src/macros.rs index 7d9f7d57d6..13ab28fae1 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -13,13 +13,16 @@ /// /// Safety comment starts on its own line. /// macro_1!(args); /// macro_2! { args }; +/// /// SAFETY: +/// /// Subsequent safety comments are allowed but not required. +/// macro_3! { args }; /// } /// ``` /// /// The macro invocations are emitted, each decorated with the following /// attribute: `#[allow(clippy::undocumented_unsafe_blocks)]`. macro_rules! safety_comment { - (#[doc = r" SAFETY:"] $(#[doc = $_doc:literal])* $($macro:ident!$args:tt;)*) => { + (#[doc = r" SAFETY:"] $($(#[doc = $_doc:literal])* $macro:ident!$args:tt;)*) => { #[allow(clippy::undocumented_unsafe_blocks)] const _: () = { $($macro!$args;)* }; }