File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
compiler/rustc_mir_transform/src/coverage Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -384,19 +384,15 @@ impl<'a> CoverageSpansGenerator<'a> {
384384 }
385385
386386 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 ( )
388+ && last. is_mergeable ( & covspan)
389+ {
390+ // Instead of pushing the new span, merge it with the last refined span.
391+ debug ! ( ?last, ?covspan, "merging new refined span with last refined span" ) ;
392+ last. merge_from ( covspan) ;
393+ } else {
394+ self . refined_spans . push ( covspan) ;
398395 }
399- self . refined_spans . push ( covspan)
400396 }
401397
402398 /// If `curr` is part of a new macro expansion, carve out and push a separate
You can’t perform that action at this time.
0 commit comments