@@ -277,14 +277,7 @@ impl DebugCounters {
277
277
278
278
pub fn add_counter ( & mut self , counter_kind : & CoverageKind , some_block_label : Option < String > ) {
279
279
if let Some ( counters) = & mut self . some_counters {
280
- let id: ExpressionOperandId = match * counter_kind {
281
- CoverageKind :: Counter { id, .. } => id. into ( ) ,
282
- CoverageKind :: Expression { id, .. } => id. into ( ) ,
283
- _ => bug ! (
284
- "the given `CoverageKind` is not an counter or expression: {:?}" ,
285
- counter_kind
286
- ) ,
287
- } ;
280
+ let id = counter_kind. as_operand_id ( ) ;
288
281
counters
289
282
. try_insert ( id, DebugCounter :: new ( counter_kind. clone ( ) , some_block_label) )
290
283
. expect ( "attempt to add the same counter_kind to DebugCounters more than once" ) ;
@@ -330,13 +323,7 @@ impl DebugCounters {
330
323
}
331
324
}
332
325
333
- let id: ExpressionOperandId = match * counter_kind {
334
- CoverageKind :: Counter { id, .. } => id. into ( ) ,
335
- CoverageKind :: Expression { id, .. } => id. into ( ) ,
336
- _ => {
337
- bug ! ( "the given `CoverageKind` is not an counter or expression: {:?}" , counter_kind)
338
- }
339
- } ;
326
+ let id = counter_kind. as_operand_id ( ) ;
340
327
if self . some_counters . is_some ( ) && ( counter_format. block || !counter_format. id ) {
341
328
let counters = self . some_counters . as_ref ( ) . unwrap ( ) ;
342
329
if let Some ( DebugCounter { some_block_label : Some ( block_label) , .. } ) =
0 commit comments