coverage: Remove redundant field prev_expn_span
This span can always be retrieved from `prev`, so there is no need to store it separately.
This commit is contained in:
parent
7bbe4be568
commit
9bb27f3adf
@ -215,9 +215,6 @@ struct CoverageSpansGenerator<'a> {
|
|||||||
/// is mutated.
|
/// is mutated.
|
||||||
prev_original_span: Span,
|
prev_original_span: Span,
|
||||||
|
|
||||||
/// A copy of the expn_span from the prior iteration.
|
|
||||||
prev_expn_span: Option<Span>,
|
|
||||||
|
|
||||||
/// One or more `CoverageSpan`s with the same `Span` but different `BasicCoverageBlock`s, and
|
/// One or more `CoverageSpan`s with the same `Span` but different `BasicCoverageBlock`s, and
|
||||||
/// no `BasicCoverageBlock` in this list dominates another `BasicCoverageBlock` in the list.
|
/// no `BasicCoverageBlock` in this list dominates another `BasicCoverageBlock` in the list.
|
||||||
/// If a new `curr` span also fits this criteria (compared to an existing list of
|
/// If a new `curr` span also fits this criteria (compared to an existing list of
|
||||||
@ -276,7 +273,6 @@ pub(super) fn generate_coverage_spans(
|
|||||||
curr_original_span: DUMMY_SP,
|
curr_original_span: DUMMY_SP,
|
||||||
some_prev: None,
|
some_prev: None,
|
||||||
prev_original_span: DUMMY_SP,
|
prev_original_span: DUMMY_SP,
|
||||||
prev_expn_span: None,
|
|
||||||
pending_dups: Vec::new(),
|
pending_dups: Vec::new(),
|
||||||
refined_spans: Vec::with_capacity(basic_coverage_blocks.num_nodes() * 2),
|
refined_spans: Vec::with_capacity(basic_coverage_blocks.num_nodes() * 2),
|
||||||
};
|
};
|
||||||
@ -399,8 +395,8 @@ fn push_refined_span(&mut self, covspan: CoverageSpan) {
|
|||||||
/// 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) {
|
||||||
let Some(visible_macro) = self.curr().visible_macro(self.body_span) else { return };
|
let Some(visible_macro) = self.curr().visible_macro(self.body_span) else { return };
|
||||||
if let Some(prev_expn_span) = &self.prev_expn_span
|
if let Some(prev) = &self.some_prev
|
||||||
&& prev_expn_span.ctxt() == self.curr().expn_span.ctxt()
|
&& prev.expn_span.ctxt() == self.curr().expn_span.ctxt()
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -479,7 +475,6 @@ fn maybe_flush_pending_dups(&mut self) {
|
|||||||
/// Advance `prev` to `curr` (if any), and `curr` to the next `CoverageSpan` in sorted order.
|
/// Advance `prev` to `curr` (if any), and `curr` to the next `CoverageSpan` in sorted order.
|
||||||
fn next_coverage_span(&mut self) -> bool {
|
fn next_coverage_span(&mut self) -> bool {
|
||||||
if let Some(curr) = self.some_curr.take() {
|
if let Some(curr) = self.some_curr.take() {
|
||||||
self.prev_expn_span = Some(curr.expn_span);
|
|
||||||
self.some_prev = Some(curr);
|
self.some_prev = Some(curr);
|
||||||
self.prev_original_span = self.curr_original_span;
|
self.prev_original_span = self.curr_original_span;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user