File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
compiler/rustc_mir_transform/src/coverage Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -383,19 +383,13 @@ impl<'a> CoverageSpansGenerator<'a> {
383
383
}
384
384
385
385
fn push_refined_span ( & mut self , covspan : CoverageSpan ) {
386
- let len = self . refined_spans . len ( ) ;
387
- if len > 0 {
388
- let last = & mut self . refined_spans [ len - 1 ] ;
389
- if last. is_mergeable ( & covspan) {
390
- debug ! (
391
- "merging new refined span with last refined span, last={:?}, covspan={:?}" ,
392
- last, covspan
393
- ) ;
394
- last. merge_from ( covspan) ;
395
- return ;
396
- }
386
+ if let Some ( last) = self . refined_spans . last_mut ( ) && last. is_mergeable ( & covspan) {
387
+ // Instead of pushing the new span, merge it with the last refined span.
388
+ debug ! ( "merging new refined span with last refined span, last={last:?}, covspan={covspan:?}" ) ;
389
+ last. merge_from ( covspan) ;
390
+ } else {
391
+ self . refined_spans . push ( covspan) ;
397
392
}
398
- self . refined_spans . push ( covspan)
399
393
}
400
394
401
395
fn check_invoked_macro_name_span ( & mut self ) {
You can’t perform that action at this time.
0 commit comments