From 244067b9d3d723e8db81c2b3bab3f857072dbab3 Mon Sep 17 00:00:00 2001 From: Seyon Sivarajah Date: Fri, 15 Dec 2023 14:56:19 +0000 Subject: [PATCH] refactor: cleanup code a bit --- tket2/src/passes/commutation.rs | 39 ++++++++++++++------------------- 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/tket2/src/passes/commutation.rs b/tket2/src/passes/commutation.rs index 66b8de7db..d5ae446f0 100644 --- a/tket2/src/passes/commutation.rs +++ b/tket2/src/passes/commutation.rs @@ -113,8 +113,7 @@ fn available_slice( ) -> Option<(usize, HashMap>)> { let mut available = None; let mut prev_nodes: HashMap> = HashMap::new(); - - for slice_index in (0..starting_index + 1).rev() { + for slice_index in (0..=starting_index).rev() { // if all qubit slots are empty here the command can be moved here if command .qubits() @@ -304,26 +303,25 @@ pub fn apply_greedy_commutation(circ: &mut Hugr) -> Result