@@ -606,32 +606,31 @@ fn span_from_macro_expansion_has_safety_comment(cx: &LateContext<'_>, span: Span
606606 let ctxt = span. ctxt ( ) ;
607607 if ctxt == SyntaxContext :: root ( ) {
608608 HasSafetyComment :: Maybe
609- } else {
610- // From a macro expansion. Get the text from the start of the macro declaration to start of the
611- // unsafe block.
612- // macro_rules! foo { () => { stuff }; (x) => { unsafe { stuff } }; }
613- // ^--------------------------------------------^
614- if let Ok ( unsafe_line) = source_map. lookup_line ( span. lo ( ) )
615- && let Ok ( macro_line) = source_map. lookup_line ( ctxt. outer_expn_data ( ) . def_site . lo ( ) )
616- && Arc :: ptr_eq ( & unsafe_line. sf , & macro_line. sf )
617- && let Some ( src) = unsafe_line. sf . src . as_deref ( )
618- {
619- if macro_line. line < unsafe_line. line {
620- match text_has_safety_comment (
621- src,
622- & unsafe_line. sf . lines ( ) [ macro_line. line + 1 ..=unsafe_line. line ] ,
623- unsafe_line. sf . start_pos ,
624- ) {
625- Some ( b) => HasSafetyComment :: Yes ( b) ,
626- None => HasSafetyComment :: No ,
627- }
628- } else {
629- HasSafetyComment :: No
609+ } else
610+ // From a macro expansion. Get the text from the start of the macro declaration to start of the
611+ // unsafe block.
612+ // macro_rules! foo { () => { stuff }; (x) => { unsafe { stuff } }; }
613+ // ^--------------------------------------------^
614+ if let Ok ( unsafe_line) = source_map. lookup_line ( span. lo ( ) )
615+ && let Ok ( macro_line) = source_map. lookup_line ( ctxt. outer_expn_data ( ) . def_site . lo ( ) )
616+ && Arc :: ptr_eq ( & unsafe_line. sf , & macro_line. sf )
617+ && let Some ( src) = unsafe_line. sf . src . as_deref ( )
618+ {
619+ if macro_line. line < unsafe_line. line {
620+ match text_has_safety_comment (
621+ src,
622+ & unsafe_line. sf . lines ( ) [ macro_line. line + 1 ..=unsafe_line. line ] ,
623+ unsafe_line. sf . start_pos ,
624+ ) {
625+ Some ( b) => HasSafetyComment :: Yes ( b) ,
626+ None => HasSafetyComment :: No ,
630627 }
631628 } else {
632- // Problem getting source text. Pretend a comment was found.
633- HasSafetyComment :: Maybe
629+ HasSafetyComment :: No
634630 }
631+ } else {
632+ // Problem getting source text. Pretend a comment was found.
633+ HasSafetyComment :: Maybe
635634 }
636635}
637636
0 commit comments