Skip to content

Commit 3773da2

Browse files
authored
[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!(); }
1 parent 9c06da2 commit 3773da2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/macros.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@
1313
/// /// Safety comment starts on its own line.
1414
/// macro_1!(args);
1515
/// macro_2! { args };
16+
/// /// SAFETY:
17+
/// /// Subsequent safety comments are allowed but not required.
18+
/// macro_3! { args };
1619
/// }
1720
/// ```
1821
///
1922
/// The macro invocations are emitted, each decorated with the following
2023
/// attribute: `#[allow(clippy::undocumented_unsafe_blocks)]`.
2124
macro_rules! safety_comment {
22-
(#[doc = r" SAFETY:"] $(#[doc = $_doc:literal])* $($macro:ident!$args:tt;)*) => {
25+
(#[doc = r" SAFETY:"] $($(#[doc = $_doc:literal])* $macro:ident!$args:tt;)*) => {
2326
#[allow(clippy::undocumented_unsafe_blocks)]
2427
const _: () = { $($macro!$args;)* };
2528
}

0 commit comments

Comments
 (0)