File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -822,7 +822,9 @@ fn text_has_safety_comment(
822822 // Don't lint if the safety comment is part of a codeblock in a doc comment.
823823 // It may or may not be required, and we can't very easily check it (and we shouldn't, since
824824 // the safety comment isn't referring to the node we're currently checking)
825- if line. trim_start_matches ( "///" ) . trim_start ( ) . starts_with ( "```" ) {
825+ if let Some ( doc) = line. strip_prefix ( "///" ) . or_else ( || line. strip_prefix ( "//!" ) )
826+ && doc. trim_start ( ) . starts_with ( "```" )
827+ {
826828 in_codeblock = !in_codeblock;
827829 }
828830
Original file line number Diff line number Diff line change @@ -100,3 +100,13 @@ mod issue_12048 {
100100}
101101
102102fn main ( ) { }
103+
104+ mod issue16553 {
105+ //! ```
106+ //! // SAFETY: All is well.
107+ //! unsafe {
108+ //! foo()
109+ //! }
110+ //! ```
111+ mod blah { }
112+ }
You can’t perform that action at this time.
0 commit comments