@@ -277,14 +277,7 @@ impl DebugCounters {
277277
278278 pub fn add_counter ( & mut self , counter_kind : & CoverageKind , some_block_label : Option < String > ) {
279279 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 ( ) ;
288281 counters
289282 . try_insert ( id, DebugCounter :: new ( counter_kind. clone ( ) , some_block_label) )
290283 . expect ( "attempt to add the same counter_kind to DebugCounters more than once" ) ;
@@ -330,13 +323,7 @@ impl DebugCounters {
330323 }
331324 }
332325
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 ( ) ;
340327 if self . some_counters . is_some ( ) && ( counter_format. block || !counter_format. id ) {
341328 let counters = self . some_counters . as_ref ( ) . unwrap ( ) ;
342329 if let Some ( DebugCounter { some_block_label : Some ( block_label) , .. } ) =
0 commit comments