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 @@ -384,19 +384,13 @@ impl<'a> CoverageSpansGenerator<'a> {
384
384
}
385
385
386
386
fn push_refined_span ( & mut self , covspan : CoverageSpan ) {
387
- let len = self . refined_spans . len ( ) ;
388
- if len > 0 {
389
- let last = & mut self . refined_spans [ len - 1 ] ;
390
- if last. is_mergeable ( & covspan) {
391
- debug ! (
392
- "merging new refined span with last refined span, last={:?}, covspan={:?}" ,
393
- last, covspan
394
- ) ;
395
- last. merge_from ( covspan) ;
396
- return ;
397
- }
387
+ if let Some ( last) = self . refined_spans . last_mut ( ) && last. is_mergeable ( & covspan) {
388
+ // Instead of pushing the new span, merge it with the last refined span.
389
+ debug ! ( "merging new refined span with last refined span, last={last:?}, covspan={covspan:?}" ) ;
390
+ last. merge_from ( covspan) ;
391
+ } else {
392
+ self . refined_spans . push ( covspan) ;
398
393
}
399
- self . refined_spans . push ( covspan)
400
394
}
401
395
402
396
fn check_invoked_macro_name_span ( & mut self ) {
You can’t perform that action at this time.
0 commit comments