From 245d024848302f0aca638d437d4647c6b8586c42 Mon Sep 17 00:00:00 2001 From: marc2332 Date: Thu, 9 Jan 2025 13:13:22 +0100 Subject: [PATCH] chore: Update torin demo example --- crates/torin/examples/demo.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/torin/examples/demo.rs b/crates/torin/examples/demo.rs index e4676c8bf..f900eea67 100644 --- a/crates/torin/examples/demo.rs +++ b/crates/torin/examples/demo.rs @@ -66,14 +66,12 @@ impl DemoDOM { // Recursively remove a Node from the DOM pub fn remove(&mut self, node_id: usize) { - let node = self.nodes.get(&node_id).unwrap().clone(); + let node = self.nodes.remove(&node_id).unwrap(); if let Some(DemoNode { children, .. }) = node.parent.and_then(|p| self.nodes.get_mut(&p)) { children.retain(|c| *c != node_id); } - self.nodes.remove(&node_id); - for child in node.children { self.remove(child); }