coverage: Simplify push_refined_span
It turns out that all of the `len` manipulation here was just reimplementing `last_mut`.
This commit is contained in:
parent
fa2e26285c
commit
5f1e8f9950
@ -384,19 +384,15 @@ fn to_refined_spans(mut self) -> Vec<CoverageSpan> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn push_refined_span(&mut self, covspan: CoverageSpan) {
|
fn push_refined_span(&mut self, covspan: CoverageSpan) {
|
||||||
let len = self.refined_spans.len();
|
if let Some(last) = self.refined_spans.last_mut()
|
||||||
if len > 0 {
|
&& last.is_mergeable(&covspan)
|
||||||
let last = &mut self.refined_spans[len - 1];
|
{
|
||||||
if last.is_mergeable(&covspan) {
|
// Instead of pushing the new span, merge it with the last refined span.
|
||||||
debug!(
|
debug!(?last, ?covspan, "merging new refined span with last refined span");
|
||||||
"merging new refined span with last refined span, last={:?}, covspan={:?}",
|
last.merge_from(covspan);
|
||||||
last, covspan
|
} else {
|
||||||
);
|
self.refined_spans.push(covspan);
|
||||||
last.merge_from(covspan);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
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
|
||||||
|
Loading…
Reference in New Issue
Block a user