Skip to content

Commit 9089d28

Browse files
committed
coverage: Inline push_refined_span
1 parent ec0110b commit 9089d28

File tree

1 file changed

+9
-13
lines changed
  • compiler/rustc_mir_transform/src/coverage

1 file changed

+9
-13
lines changed

compiler/rustc_mir_transform/src/coverage/spans.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ impl<'a> CoverageSpansGenerator<'a> {
275275
" different bcbs and disjoint spans, so keep curr for next iter, and add prev={prev:?}",
276276
);
277277
let prev = self.take_prev();
278-
self.push_refined_span(prev);
278+
self.refined_spans.push(prev);
279279
self.maybe_push_macro_name_span();
280280
} else if prev.is_closure {
281281
// drop any equal or overlapping span (`curr`) and keep `prev` to test again in the
@@ -326,7 +326,7 @@ impl<'a> CoverageSpansGenerator<'a> {
326326
// It is never used as a field after this point.
327327
for dup in std::mem::take(&mut self.pending_dups) {
328328
debug!(" ...adding at least one pending dup={:?}", dup);
329-
self.push_refined_span(dup);
329+
self.refined_spans.push(dup);
330330
}
331331

332332
// Async functions wrap a closure that implements the body to be executed. The enclosing
@@ -343,7 +343,7 @@ impl<'a> CoverageSpansGenerator<'a> {
343343
};
344344

345345
if !body_ends_with_closure {
346-
self.push_refined_span(prev);
346+
self.refined_spans.push(prev);
347347
}
348348

349349
// Do one last merge pass, to simplify the output.
@@ -364,10 +364,6 @@ impl<'a> CoverageSpansGenerator<'a> {
364364
self.refined_spans
365365
}
366366

367-
fn push_refined_span(&mut self, covspan: CoverageSpan) {
368-
self.refined_spans.push(covspan);
369-
}
370-
371367
/// If `curr` is part of a new macro expansion, carve out and push a separate
372368
/// span that ends just after the macro name and its subsequent `!`.
373369
fn maybe_push_macro_name_span(&mut self) {
@@ -400,7 +396,7 @@ impl<'a> CoverageSpansGenerator<'a> {
400396
" and curr starts a new macro expansion, so add a new span just for \
401397
the macro `{visible_macro}!`, new span={macro_name_cov:?}",
402398
);
403-
self.push_refined_span(macro_name_cov);
399+
self.refined_spans.push(macro_name_cov);
404400
}
405401

406402
fn curr(&self) -> &CoverageSpan {
@@ -462,7 +458,7 @@ impl<'a> CoverageSpansGenerator<'a> {
462458
let mut pending_dups = std::mem::take(&mut self.pending_dups);
463459
for dup in pending_dups.drain(..) {
464460
debug!(" ...adding at least one pending={:?}", dup);
465-
self.push_refined_span(dup);
461+
self.refined_spans.push(dup);
466462
}
467463
// The list of dups is now empty, but we can recycle its capacity.
468464
assert!(pending_dups.is_empty() && self.pending_dups.is_empty());
@@ -528,10 +524,10 @@ impl<'a> CoverageSpansGenerator<'a> {
528524
for mut dup in pending_dups.iter().cloned() {
529525
dup.span = dup.span.with_hi(left_cutoff);
530526
debug!(" ...and at least one pre_closure dup={:?}", dup);
531-
self.push_refined_span(dup);
527+
self.refined_spans.push(dup);
532528
}
533529
}
534-
self.push_refined_span(pre_closure);
530+
self.refined_spans.push(pre_closure);
535531
}
536532

537533
if has_post_closure_span {
@@ -545,7 +541,7 @@ impl<'a> CoverageSpansGenerator<'a> {
545541
dup.span = dup.span.with_lo(right_cutoff);
546542
}
547543
let closure_covspan = self.take_curr(); // Prevent this curr from becoming prev.
548-
self.push_refined_span(closure_covspan); // since self.prev() was already updated
544+
self.refined_spans.push(closure_covspan); // since self.prev() was already updated
549545
} else {
550546
pending_dups.clear();
551547
}
@@ -648,7 +644,7 @@ impl<'a> CoverageSpansGenerator<'a> {
648644
} else {
649645
debug!(" ... adding modified prev={:?}", self.prev());
650646
let prev = self.take_prev();
651-
self.push_refined_span(prev);
647+
self.refined_spans.push(prev);
652648
}
653649
} else {
654650
// with `pending_dups`, `prev` cannot have any statements that don't overlap

0 commit comments

Comments
 (0)