@@ -394,27 +394,25 @@ impl<'a> CoverageSpansGenerator<'a> {
394394 }
395395
396396 fn check_invoked_macro_name_span ( & mut self ) {
397- if let Some ( visible_macro) = self . curr ( ) . visible_macro ( self . body_span ) {
398- if !self
399- . prev_expn_span
400- . is_some_and ( |prev_expn_span| self . curr ( ) . expn_span . ctxt ( ) == prev_expn_span. ctxt ( ) )
401- {
402- let merged_prefix_len = self . curr_original_span . lo ( ) - self . curr ( ) . span . lo ( ) ;
403- let after_macro_bang =
404- merged_prefix_len + BytePos ( visible_macro. as_str ( ) . len ( ) as u32 + 1 ) ;
405- let mut macro_name_cov = self . curr ( ) . clone ( ) ;
406- self . curr_mut ( ) . span =
407- self . curr ( ) . span . with_lo ( self . curr ( ) . span . lo ( ) + after_macro_bang) ;
408- macro_name_cov. span =
409- macro_name_cov. span . with_hi ( macro_name_cov. span . lo ( ) + after_macro_bang) ;
410- debug ! (
411- " and curr starts a new macro expansion, so add a new span just for \
412- the macro `{}!`, new span={:?}",
413- visible_macro, macro_name_cov
414- ) ;
415- self . push_refined_span ( macro_name_cov) ;
416- }
397+ let Some ( visible_macro) = self . curr ( ) . visible_macro ( self . body_span ) else { return } ;
398+ if let Some ( prev_expn_span) = & self . prev_expn_span
399+ && prev_expn_span. ctxt ( ) == self . curr ( ) . expn_span . ctxt ( )
400+ {
401+ return ;
417402 }
403+
404+ let merged_prefix_len = self . curr_original_span . lo ( ) - self . curr ( ) . span . lo ( ) ;
405+ let after_macro_bang = merged_prefix_len + BytePos ( visible_macro. as_str ( ) . len ( ) as u32 + 1 ) ;
406+ let mut macro_name_cov = self . curr ( ) . clone ( ) ;
407+ self . curr_mut ( ) . span = self . curr ( ) . span . with_lo ( self . curr ( ) . span . lo ( ) + after_macro_bang) ;
408+ macro_name_cov. span =
409+ macro_name_cov. span . with_hi ( macro_name_cov. span . lo ( ) + after_macro_bang) ;
410+ debug ! (
411+ " and curr starts a new macro expansion, so add a new span just for \
412+ the macro `{}!`, new span={:?}",
413+ visible_macro, macro_name_cov
414+ ) ;
415+ self . push_refined_span ( macro_name_cov) ;
418416 }
419417
420418 fn curr ( & self ) -> & CoverageSpan {
0 commit comments