Skip to content

Commit

Permalink
chore: Update torin demo example
Browse files Browse the repository at this point in the history
  • Loading branch information
marc2332 committed Jan 9, 2025
1 parent b586ccc commit 245d024
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/torin/examples/demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 245d024

Please sign in to comment.