diff --git a/crates/accelerate/src/dense_layout.rs b/crates/accelerate/src/dense_layout.rs index 901a906d9c81..9529742d7e62 100644 --- a/crates/accelerate/src/dense_layout.rs +++ b/crates/accelerate/src/dense_layout.rs @@ -197,7 +197,7 @@ pub fn best_subset_inner( SubsetResult { count: 0, map: Vec::new(), - error: std::f64::INFINITY, + error: f64::INFINITY, subgraph: Vec::new(), } }; diff --git a/crates/accelerate/src/nlayout.rs b/crates/accelerate/src/nlayout.rs index 1a0b73b25fed..b3709d2804bb 100644 --- a/crates/accelerate/src/nlayout.rs +++ b/crates/accelerate/src/nlayout.rs @@ -107,8 +107,8 @@ impl NLayout { physical_qubits: usize, ) -> Self { let mut res = NLayout { - virt_to_phys: vec![PhysicalQubit(std::u32::MAX); virtual_qubits], - phys_to_virt: vec![VirtualQubit(std::u32::MAX); physical_qubits], + virt_to_phys: vec![PhysicalQubit(u32::MAX); virtual_qubits], + phys_to_virt: vec![VirtualQubit(u32::MAX); physical_qubits], }; for (virt, phys) in qubit_indices { res.virt_to_phys[virt.index()] = phys; @@ -184,7 +184,7 @@ impl NLayout { #[staticmethod] pub fn from_virtual_to_physical(virt_to_phys: Vec) -> PyResult { - let mut phys_to_virt = vec![VirtualQubit(std::u32::MAX); virt_to_phys.len()]; + let mut phys_to_virt = vec![VirtualQubit(u32::MAX); virt_to_phys.len()]; for (virt, phys) in virt_to_phys.iter().enumerate() { phys_to_virt[phys.index()] = VirtualQubit(virt.try_into()?); } diff --git a/crates/accelerate/src/stochastic_swap.rs b/crates/accelerate/src/stochastic_swap.rs index bc13325d8d96..d4e3890b9ccb 100644 --- a/crates/accelerate/src/stochastic_swap.rs +++ b/crates/accelerate/src/stochastic_swap.rs @@ -112,10 +112,10 @@ fn swap_trial( let mut new_cost: f64; let mut dist: f64; - let mut optimal_start = PhysicalQubit::new(std::u32::MAX); - let mut optimal_end = PhysicalQubit::new(std::u32::MAX); - let mut optimal_start_qubit = VirtualQubit::new(std::u32::MAX); - let mut optimal_end_qubit = VirtualQubit::new(std::u32::MAX); + let mut optimal_start = PhysicalQubit::new(u32::MAX); + let mut optimal_end = PhysicalQubit::new(u32::MAX); + let mut optimal_start_qubit = VirtualQubit::new(u32::MAX); + let mut optimal_end_qubit = VirtualQubit::new(u32::MAX); let mut scale = Array2::zeros((num_qubits, num_qubits)); @@ -270,7 +270,7 @@ pub fn swap_trials( // unless force threads is set. let run_in_parallel = getenv_use_multiple_threads(); - let mut best_depth = std::usize::MAX; + let mut best_depth = usize::MAX; let mut best_edges: Option = None; let mut best_layout: Option = None; if run_in_parallel { diff --git a/crates/circuit/src/circuit_instruction.rs b/crates/circuit/src/circuit_instruction.rs index 781a776c1566..74302b526d51 100644 --- a/crates/circuit/src/circuit_instruction.rs +++ b/crates/circuit/src/circuit_instruction.rs @@ -825,10 +825,7 @@ pub(crate) fn convert_py_to_operation_type( }; let op_type: Bound = raw_op_type.into_bound(py); let mut standard: Option = match op_type.getattr(attr) { - Ok(stdgate) => match stdgate.extract().ok() { - Some(gate) => gate, - None => None, - }, + Ok(stdgate) => stdgate.extract().ok().unwrap_or_default(), Err(_) => None, }; // If the input instruction is a standard gate and a singleton instance