File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,16 @@ fn comment_and_requirement(
187187 node : Node ,
188188 src : & [ u8 ] ,
189189) -> Result < ( Option < Comment > , Option < Feature > ) , Box < dyn Error > > {
190- let maybe_comment = Comment :: new ( node, src) . ok ( ) ;
190+ let mut maybe_comment = Comment :: new ( node, src) . ok ( ) ;
191+
192+ // If node wasn't a comment, see if it was an expression_statement
193+ // that itself was preceded by a comment. This skips over
194+ // expression-like preprocessor attributes on function decls.
195+ if let ( None , "expression_statement" , Some ( prev) ) =
196+ ( & maybe_comment, node. kind ( ) , node. prev_sibling ( ) )
197+ {
198+ maybe_comment = Comment :: new ( prev, src) . ok ( ) ;
199+ }
191200
192201 // If prev wasn't a comment, see if it was a feature requirement.
193202 if maybe_comment. is_none ( ) {
You can’t perform that action at this time.
0 commit comments