Make Node::is_parent_of more idiomatic

This commit is contained in:
Brandon Fairchild 2015-11-17 16:58:37 -05:00
parent 20d26853e1
commit 6a28d62b15

View file

@ -599,10 +599,7 @@ impl Node {
} }
pub fn is_parent_of(&self, child: &Node) -> bool { pub fn is_parent_of(&self, child: &Node) -> bool {
match child.parent_node.get() { child.parent_node.get().map_or(false, |ref parent| parent.r() == self)
Some(ref parent) => parent.r() == self,
None => false,
}
} }
pub fn to_trusted_node_address(&self) -> TrustedNodeAddress { pub fn to_trusted_node_address(&self) -> TrustedNodeAddress {