From ffde56d27d7a41b4cdc8f7c22706c2744171e6c4 Mon Sep 17 00:00:00 2001 From: Alan Lawrence Date: Sun, 25 Jun 2023 10:21:55 +0100 Subject: [PATCH] simple_replace.rs: use HugrMut::remove_node, includes clearing op_types --- src/hugr/rewrite/simple_replace.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/hugr/rewrite/simple_replace.rs b/src/hugr/rewrite/simple_replace.rs index e688fd342..32fd58698 100644 --- a/src/hugr/rewrite/simple_replace.rs +++ b/src/hugr/rewrite/simple_replace.rs @@ -3,7 +3,7 @@ use std::collections::{HashMap, HashSet}; use itertools::Itertools; -use portgraph::{LinkMut, LinkView, MultiMut, NodeIndex, PortMut, PortView}; +use portgraph::{LinkMut, LinkView, MultiMut, NodeIndex, PortView}; use crate::hugr::{HugrMut, HugrView}; use crate::{ @@ -227,8 +227,7 @@ impl Rewrite for SimpleReplacement { } // 3.5. Remove all nodes in self.removal and edges between them. for node in &self.removal { - h.graph.remove_node(node.index); - h.hierarchy.remove(node.index); + h.remove_node(*node).unwrap(); } Ok(()) }