diff --git a/crates/accelerate/src/target.rs b/crates/accelerate/src/target.rs index 86680021498a..115d9b72bcec 100644 --- a/crates/accelerate/src/target.rs +++ b/crates/accelerate/src/target.rs @@ -264,10 +264,7 @@ impl Target { .max(qarg.vec.iter().cloned().fold(0, u32::max) as usize + 1), ); } - if let Some(x) = qargs_val.get_mut(&qarg) { - let prop_qarg: Option = properties[&qarg].clone(); - *x = prop_qarg; - } + qargs_val.insert(qarg.clone(), properties[&qarg].clone()); self.qarg_gate_map .entry(qarg) .and_modify(|e| { @@ -280,9 +277,7 @@ impl Target { ))); } } - if let Some(gate_name) = self.gate_map.get_mut(&instruction_name) { - *gate_name = qargs_val; - } + self.gate_map.insert(instruction_name, qargs_val); self.instruction_durations = None; self.instruction_schedule_map = None; Ok(()) @@ -308,7 +303,7 @@ impl Target { // For debugging if !self.gate_map.contains_key(&instruction) { panic!( - "Provided instruction : '{:?}' not in this Target.", + "Provided instruction: '{:?}' not in this Target.", &instruction ); }; diff --git a/qiskit/transpiler/_target.py b/qiskit/transpiler/_target.py index 42fc988245ee..a435a2b90098 100644 --- a/qiskit/transpiler/_target.py +++ b/qiskit/transpiler/_target.py @@ -576,7 +576,7 @@ def check_obj_params(parameters, obj): return False return True - return self._Target.instructions_supported( + return self._Target.instruction_supported( inspect.isclass, isinstance, Parameter,