coverage: Inline push_refined_span
This commit is contained in:
parent
ec0110be09
commit
9089d28780
1 changed files with 9 additions and 13 deletions
|
@ -275,7 +275,7 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
" different bcbs and disjoint spans, so keep curr for next iter, and add prev={prev:?}",
|
" different bcbs and disjoint spans, so keep curr for next iter, and add prev={prev:?}",
|
||||||
);
|
);
|
||||||
let prev = self.take_prev();
|
let prev = self.take_prev();
|
||||||
self.push_refined_span(prev);
|
self.refined_spans.push(prev);
|
||||||
self.maybe_push_macro_name_span();
|
self.maybe_push_macro_name_span();
|
||||||
} else if prev.is_closure {
|
} else if prev.is_closure {
|
||||||
// drop any equal or overlapping span (`curr`) and keep `prev` to test again in the
|
// drop any equal or overlapping span (`curr`) and keep `prev` to test again in the
|
||||||
|
@ -326,7 +326,7 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
// It is never used as a field after this point.
|
// It is never used as a field after this point.
|
||||||
for dup in std::mem::take(&mut self.pending_dups) {
|
for dup in std::mem::take(&mut self.pending_dups) {
|
||||||
debug!(" ...adding at least one pending dup={:?}", dup);
|
debug!(" ...adding at least one pending dup={:?}", dup);
|
||||||
self.push_refined_span(dup);
|
self.refined_spans.push(dup);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Async functions wrap a closure that implements the body to be executed. The enclosing
|
// Async functions wrap a closure that implements the body to be executed. The enclosing
|
||||||
|
@ -343,7 +343,7 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
if !body_ends_with_closure {
|
if !body_ends_with_closure {
|
||||||
self.push_refined_span(prev);
|
self.refined_spans.push(prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do one last merge pass, to simplify the output.
|
// Do one last merge pass, to simplify the output.
|
||||||
|
@ -364,10 +364,6 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
self.refined_spans
|
self.refined_spans
|
||||||
}
|
}
|
||||||
|
|
||||||
fn push_refined_span(&mut self, covspan: CoverageSpan) {
|
|
||||||
self.refined_spans.push(covspan);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// If `curr` is part of a new macro expansion, carve out and push a separate
|
/// If `curr` is part of a new macro expansion, carve out and push a separate
|
||||||
/// span that ends just after the macro name and its subsequent `!`.
|
/// span that ends just after the macro name and its subsequent `!`.
|
||||||
fn maybe_push_macro_name_span(&mut self) {
|
fn maybe_push_macro_name_span(&mut self) {
|
||||||
|
@ -400,7 +396,7 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
" and curr starts a new macro expansion, so add a new span just for \
|
" and curr starts a new macro expansion, so add a new span just for \
|
||||||
the macro `{visible_macro}!`, new span={macro_name_cov:?}",
|
the macro `{visible_macro}!`, new span={macro_name_cov:?}",
|
||||||
);
|
);
|
||||||
self.push_refined_span(macro_name_cov);
|
self.refined_spans.push(macro_name_cov);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn curr(&self) -> &CoverageSpan {
|
fn curr(&self) -> &CoverageSpan {
|
||||||
|
@ -462,7 +458,7 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
let mut pending_dups = std::mem::take(&mut self.pending_dups);
|
let mut pending_dups = std::mem::take(&mut self.pending_dups);
|
||||||
for dup in pending_dups.drain(..) {
|
for dup in pending_dups.drain(..) {
|
||||||
debug!(" ...adding at least one pending={:?}", dup);
|
debug!(" ...adding at least one pending={:?}", dup);
|
||||||
self.push_refined_span(dup);
|
self.refined_spans.push(dup);
|
||||||
}
|
}
|
||||||
// The list of dups is now empty, but we can recycle its capacity.
|
// The list of dups is now empty, but we can recycle its capacity.
|
||||||
assert!(pending_dups.is_empty() && self.pending_dups.is_empty());
|
assert!(pending_dups.is_empty() && self.pending_dups.is_empty());
|
||||||
|
@ -528,10 +524,10 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
for mut dup in pending_dups.iter().cloned() {
|
for mut dup in pending_dups.iter().cloned() {
|
||||||
dup.span = dup.span.with_hi(left_cutoff);
|
dup.span = dup.span.with_hi(left_cutoff);
|
||||||
debug!(" ...and at least one pre_closure dup={:?}", dup);
|
debug!(" ...and at least one pre_closure dup={:?}", dup);
|
||||||
self.push_refined_span(dup);
|
self.refined_spans.push(dup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.push_refined_span(pre_closure);
|
self.refined_spans.push(pre_closure);
|
||||||
}
|
}
|
||||||
|
|
||||||
if has_post_closure_span {
|
if has_post_closure_span {
|
||||||
|
@ -545,7 +541,7 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
dup.span = dup.span.with_lo(right_cutoff);
|
dup.span = dup.span.with_lo(right_cutoff);
|
||||||
}
|
}
|
||||||
let closure_covspan = self.take_curr(); // Prevent this curr from becoming prev.
|
let closure_covspan = self.take_curr(); // Prevent this curr from becoming prev.
|
||||||
self.push_refined_span(closure_covspan); // since self.prev() was already updated
|
self.refined_spans.push(closure_covspan); // since self.prev() was already updated
|
||||||
} else {
|
} else {
|
||||||
pending_dups.clear();
|
pending_dups.clear();
|
||||||
}
|
}
|
||||||
|
@ -648,7 +644,7 @@ impl<'a> CoverageSpansGenerator<'a> {
|
||||||
} else {
|
} else {
|
||||||
debug!(" ... adding modified prev={:?}", self.prev());
|
debug!(" ... adding modified prev={:?}", self.prev());
|
||||||
let prev = self.take_prev();
|
let prev = self.take_prev();
|
||||||
self.push_refined_span(prev);
|
self.refined_spans.push(prev);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// with `pending_dups`, `prev` cannot have any statements that don't overlap
|
// with `pending_dups`, `prev` cannot have any statements that don't overlap
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue