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> {
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 ( )
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) ;
398
395
}
399
- self . refined_spans . push ( covspan)
400
396
}
401
397
402
398
fn check_invoked_macro_name_span ( & mut self ) {
You can’t perform that action at this time.
0 commit comments