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