@@ -398,27 +398,25 @@ impl<'a> CoverageSpansGenerator<'a> {
398
398
/// If `curr` is part of a new macro expansion, carve out and push a separate
399
399
/// span that ends just after the macro name and its subsequent `!`.
400
400
fn maybe_push_macro_name_span ( & mut self ) {
401
- if let Some ( visible_macro) = self . curr ( ) . visible_macro ( self . body_span ) {
402
- if !self
403
- . prev_expn_span
404
- . is_some_and ( |prev_expn_span| self . curr ( ) . expn_span . ctxt ( ) == prev_expn_span. ctxt ( ) )
405
- {
406
- let merged_prefix_len = self . curr_original_span . lo ( ) - self . curr ( ) . span . lo ( ) ;
407
- let after_macro_bang =
408
- merged_prefix_len + BytePos ( visible_macro. as_str ( ) . len ( ) as u32 + 1 ) ;
409
- let mut macro_name_cov = self . curr ( ) . clone ( ) ;
410
- self . curr_mut ( ) . span =
411
- self . curr ( ) . span . with_lo ( self . curr ( ) . span . lo ( ) + after_macro_bang) ;
412
- macro_name_cov. span =
413
- macro_name_cov. span . with_hi ( macro_name_cov. span . lo ( ) + after_macro_bang) ;
414
- debug ! (
415
- " and curr starts a new macro expansion, so add a new span just for \
416
- the macro `{}!`, new span={:?}",
417
- visible_macro, macro_name_cov
418
- ) ;
419
- self . push_refined_span ( macro_name_cov) ;
420
- }
401
+ let Some ( visible_macro) = self . curr ( ) . visible_macro ( self . body_span ) else { return } ;
402
+ if let Some ( prev_expn_span) = & self . prev_expn_span
403
+ && prev_expn_span. ctxt ( ) == self . curr ( ) . expn_span . ctxt ( )
404
+ {
405
+ return ;
421
406
}
407
+
408
+ let merged_prefix_len = self . curr_original_span . lo ( ) - self . curr ( ) . span . lo ( ) ;
409
+ let after_macro_bang = merged_prefix_len + BytePos ( visible_macro. as_str ( ) . len ( ) as u32 + 1 ) ;
410
+ let mut macro_name_cov = self . curr ( ) . clone ( ) ;
411
+ self . curr_mut ( ) . span = self . curr ( ) . span . with_lo ( self . curr ( ) . span . lo ( ) + after_macro_bang) ;
412
+ macro_name_cov. span =
413
+ macro_name_cov. span . with_hi ( macro_name_cov. span . lo ( ) + after_macro_bang) ;
414
+ debug ! (
415
+ " and curr starts a new macro expansion, so add a new span just for \
416
+ the macro `{}!`, new span={:?}",
417
+ visible_macro, macro_name_cov
418
+ ) ;
419
+ self . push_refined_span ( macro_name_cov) ;
422
420
}
423
421
424
422
fn curr ( & self ) -> & CoverageSpan {
0 commit comments