Skip to content

Commit

Permalink
minor tidy
Browse files Browse the repository at this point in the history
  • Loading branch information
ss2165 committed Sep 6, 2024
1 parent 2626722 commit e218812
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tket2-hseries/src/extension/hseries/lower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ pub enum LowerTk2Error {
}

fn op_to_hugr(op: Tk2Op) -> Result<Hugr, LowerTk2Error> {
let optype: ops::ExtensionOp = op.into_extension_op();
let sig = optype.signature();
let sig = op.into_extension_op().signature();
let sig = Signature::new(sig.input, sig.output); // ignore extension delta
let mut b = DFGBuilder::new(sig)?;
let inputs: Vec<_> = b.input_wires().collect();
Expand Down Expand Up @@ -94,10 +93,8 @@ pub fn lower_tk2_op(mut hugr: impl HugrMut) -> Result<Vec<hugr::Node>, LowerTk2E
};
}

let lowered_nodes = hugr::algorithms::lower_ops(&mut hugr, |op| {
let op: Tk2Op = op.cast()?;
hugr_map.get(&op).cloned()
})?;
let lowered_nodes =
hugr::algorithms::lower_ops(&mut hugr, |op| hugr_map.get(&op.cast()?).cloned())?;

Ok([replaced_nodes, lowered_nodes].concat())
}
Expand Down

0 comments on commit e218812

Please sign in to comment.