3 ms·
c) a bad practice since it will make your program crash is a node has no parent. if the node always having a parent is a invariant of your application, you sho
by stymaar 10y ago
c) a bad practice since it will make your program crash is a node has no parent.
if the node always having a parent is a invariant of your application, you should use `expect` with a clear error message when the invariant is broken.
if your node can have no parents then you want to handle this case explicitly with a `if let Some(parent) = node.parent() {` pattern.