coverage: Remove next_id
methods from counter/expression IDs
When these methods were originally written, I wasn't aware that `newtype_index!` already supports addition with ordinary numbers, without needing to unwrap and re-wrap.
This commit is contained in:
parent
b1cf0c8f1b
commit
053c4f94a0
@ -18,11 +18,6 @@ rustc_index::newtype_index! {
|
|||||||
|
|
||||||
impl CounterId {
|
impl CounterId {
|
||||||
pub const START: Self = Self::from_u32(0);
|
pub const START: Self = Self::from_u32(0);
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn next_id(self) -> Self {
|
|
||||||
Self::from_u32(self.as_u32() + 1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rustc_index::newtype_index! {
|
rustc_index::newtype_index! {
|
||||||
@ -38,11 +33,6 @@ rustc_index::newtype_index! {
|
|||||||
|
|
||||||
impl ExpressionId {
|
impl ExpressionId {
|
||||||
pub const START: Self = Self::from_u32(0);
|
pub const START: Self = Self::from_u32(0);
|
||||||
|
|
||||||
#[inline(always)]
|
|
||||||
pub fn next_id(self) -> Self {
|
|
||||||
Self::from_u32(self.as_u32() + 1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Operand of a coverage-counter expression.
|
/// Operand of a coverage-counter expression.
|
||||||
|
@ -114,7 +114,7 @@ impl CoverageCounters {
|
|||||||
/// Counter IDs start from one and go up.
|
/// Counter IDs start from one and go up.
|
||||||
fn next_counter(&mut self) -> CounterId {
|
fn next_counter(&mut self) -> CounterId {
|
||||||
let next = self.next_counter_id;
|
let next = self.next_counter_id;
|
||||||
self.next_counter_id = next.next_id();
|
self.next_counter_id = self.next_counter_id + 1;
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +122,7 @@ impl CoverageCounters {
|
|||||||
/// (Counter IDs and Expression IDs are distinguished by the `Operand` enum.)
|
/// (Counter IDs and Expression IDs are distinguished by the `Operand` enum.)
|
||||||
fn next_expression(&mut self) -> ExpressionId {
|
fn next_expression(&mut self) -> ExpressionId {
|
||||||
let next = self.next_expression_id;
|
let next = self.next_expression_id;
|
||||||
self.next_expression_id = next.next_id();
|
self.next_expression_id = self.next_expression_id + 1;
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user