diff --git a/hugr-core/src/builder/dataflow.rs b/hugr-core/src/builder/dataflow.rs index c81d684d2..736cc7659 100644 --- a/hugr-core/src/builder/dataflow.rs +++ b/hugr-core/src/builder/dataflow.rs @@ -138,7 +138,11 @@ impl FunctionBuilder { /// # Errors /// /// Error in adding DFG child nodes. - pub fn new(name: impl Into, signature: PolyFuncType) -> Result { + pub fn new( + name: impl Into, + signature: impl Into, + ) -> Result { + let signature = signature.into(); let body = signature.body().clone(); let op = ops::FuncDefn { signature, @@ -328,10 +332,8 @@ pub(crate) mod test { #[test] fn simple_inter_graph_edge() { let builder = || -> Result { - let mut f_build = FunctionBuilder::new( - "main", - FunctionType::new(type_row![BIT], type_row![BIT]).into(), - )?; + let mut f_build = + FunctionBuilder::new("main", FunctionType::new(type_row![BIT], type_row![BIT]))?; let [i1] = f_build.input_wires_arr(); let noop = f_build.add_dataflow_op(Noop { ty: BIT }, [i1])?; @@ -352,10 +354,8 @@ pub(crate) mod test { #[test] fn error_on_linear_inter_graph_edge() -> Result<(), BuildError> { - let mut f_build = FunctionBuilder::new( - "main", - FunctionType::new(type_row![QB], type_row![QB]).into(), - )?; + let mut f_build = + FunctionBuilder::new("main", FunctionType::new(type_row![QB], type_row![QB]))?; let [i1] = f_build.input_wires_arr(); let noop = f_build.add_dataflow_op(Noop { ty: QB }, [i1])?; diff --git a/hugr-core/src/hugr/views/sibling_subgraph.rs b/hugr-core/src/hugr/views/sibling_subgraph.rs index 24e03c368..889e5e5ae 100644 --- a/hugr-core/src/hugr/views/sibling_subgraph.rs +++ b/hugr-core/src/hugr/views/sibling_subgraph.rs @@ -415,7 +415,7 @@ impl SiblingSubgraph { /// The new Hugr will contain a [FuncDefn][crate::ops::FuncDefn] root /// with the same signature as the subgraph and the specified `name` pub fn extract_subgraph(&self, hugr: &impl HugrView, name: impl Into) -> Hugr { - let mut builder = FunctionBuilder::new(name, self.signature(hugr).into()).unwrap(); + let mut builder = FunctionBuilder::new(name, self.signature(hugr)).unwrap(); // Take the unfinished Hugr from the builder, to avoid unnecessary // validation checks that require connecting the inputs and outputs. let mut extracted = mem::take(builder.hugr_mut());