Skip to content

Commit

Permalink
Remove no longer needed enum variant parens.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhartman committed Nov 22, 2024
1 parent 0e6634b commit 06ede59
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions crates/circuit/src/circuit_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,8 +718,8 @@ impl<'py> FromPyObject<'py> for OperationFromPython {
let unit = ob.getattr(intern!(py, "unit"))?.extract()?;
StandardInstruction::Delay(unit)
}
StandardInstructionType::Measure => StandardInstruction::Measure(),
StandardInstructionType::Reset => StandardInstruction::Reset(),
StandardInstructionType::Measure => StandardInstruction::Measure,
StandardInstructionType::Reset => StandardInstruction::Reset,
};
return Ok(OperationFromPython {
operation: PackedOperation::from_standard_instruction(standard),
Expand Down
24 changes: 12 additions & 12 deletions crates/circuit/src/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ unsafe impl ::bytemuck::NoUninit for StandardInstructionType {}
pub enum StandardInstruction {
Barrier(usize),
Delay(DelayUnit),
Measure(),
Reset(),
Measure,
Reset,
}

// This must be kept up-to-date with `StandardInstruction` when adding or removing
Expand All @@ -389,26 +389,26 @@ impl Operation for StandardInstruction {
match self {
StandardInstruction::Barrier(_) => "barrier",
StandardInstruction::Delay(_) => "delay",
StandardInstruction::Measure() => "measure",
StandardInstruction::Reset() => "reset",
StandardInstruction::Measure => "measure",
StandardInstruction::Reset => "reset",
}
}

fn num_qubits(&self) -> u32 {
match self {
StandardInstruction::Barrier(num_qubits) => *num_qubits as u32,
StandardInstruction::Delay(_) => 1,
StandardInstruction::Measure() => 1,
StandardInstruction::Reset() => 1,
StandardInstruction::Measure => 1,
StandardInstruction::Reset => 1,
}
}

fn num_clbits(&self) -> u32 {
match self {
StandardInstruction::Barrier(_) => 0,
StandardInstruction::Delay(_) => 0,
StandardInstruction::Measure() => 1,
StandardInstruction::Reset() => 0,
StandardInstruction::Measure => 1,
StandardInstruction::Reset => 0,
}
}

Expand Down Expand Up @@ -440,8 +440,8 @@ impl Operation for StandardInstruction {
match self {
StandardInstruction::Barrier(_) => true,
StandardInstruction::Delay(_) => false,
StandardInstruction::Measure() => false,
StandardInstruction::Reset() => false,
StandardInstruction::Measure => false,
StandardInstruction::Reset => false,
}
}
}
Expand Down Expand Up @@ -470,8 +470,8 @@ impl StandardInstruction {
.get_bound(py)
.call1((duration.to_object(py), unit.to_string()))?
}
StandardInstruction::Measure() => MEASURE.get_bound(py).call((), kwargs.as_ref())?,
StandardInstruction::Reset() => RESET.get_bound(py).call((), kwargs.as_ref())?,
StandardInstruction::Measure => MEASURE.get_bound(py).call((), kwargs.as_ref())?,
StandardInstruction::Reset => RESET.get_bound(py).call((), kwargs.as_ref())?,
};

if label.is_some() || unit.is_some() || duration.is_some() || condition.is_some() {
Expand Down
12 changes: 6 additions & 6 deletions crates/circuit/src/packed_instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ impl PackedOperation {
let unit: DelayUnit = ::bytemuck::checked::cast(payload(self) as u8);
Some(StandardInstruction::Delay(unit))
}
StandardInstructionType::Measure => Some(StandardInstruction::Measure()),
StandardInstructionType::Reset => Some(StandardInstruction::Reset()),
StandardInstructionType::Measure => Some(StandardInstruction::Measure),
StandardInstructionType::Reset => Some(StandardInstruction::Reset),
}
}
_ => None,
Expand Down Expand Up @@ -299,8 +299,8 @@ impl PackedOperation {
((unit as usize) << Self::STANDARD_INSTRUCTION_BITS)
| (StandardInstructionType::Delay as usize)
}
StandardInstruction::Measure() => StandardInstructionType::Measure as usize,
StandardInstruction::Reset() => StandardInstructionType::Reset as usize,
StandardInstruction::Measure => StandardInstructionType::Measure as usize,
StandardInstruction::Reset => StandardInstructionType::Reset as usize,
};
Self((body << Self::DISCRIMINANT_BITS) | PackedOperationType::StandardInstruction as usize)
}
Expand Down Expand Up @@ -470,11 +470,11 @@ impl PackedOperation {
.get_bound(py)
.downcast::<PyType>()?
.is_subclass(py_type),
StandardInstruction::Measure() => MEASURE
StandardInstruction::Measure => MEASURE
.get_bound(py)
.downcast::<PyType>()?
.is_subclass(py_type),
StandardInstruction::Reset() => RESET
StandardInstruction::Reset => RESET
.get_bound(py)
.downcast::<PyType>()?
.is_subclass(py_type),
Expand Down

0 comments on commit 06ede59

Please sign in to comment.