From 23737d70d977d1f833056c94c4c5488d377ba0a8 Mon Sep 17 00:00:00 2001 From: Agustin Borgna Date: Sat, 16 Sep 2023 23:08:42 +0100 Subject: [PATCH] Use `HugrView::get_io` when possible --- src/circuit.rs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/circuit.rs b/src/circuit.rs index 7219705e..d3019a9f 100644 --- a/src/circuit.rs +++ b/src/circuit.rs @@ -43,19 +43,14 @@ pub trait Circuit: HugrView { /// Returns the input node to the circuit. #[inline] fn input(&self) -> Node { - return self - .children(self.root()) - .next() - .expect("Circuit has no input node"); + self.get_io(self.root()).expect("Circuit has no input node")[0] } /// Returns the output node to the circuit. #[inline] fn output(&self) -> Node { - return self - .children(self.root()) - .nth(1) - .expect("Circuit has no output node"); + self.get_io(self.root()) + .expect("Circuit has no output node")[1] } /// The number of quantum gates in the circuit.