Use try syntax for Option where appropriate

This commit is contained in:
Matt Brubeck 2017-10-20 08:25:35 -07:00
parent fe16c1d5c3
commit 2d45e9d2da
19 changed files with 65 additions and 180 deletions

View file

@ -395,13 +395,9 @@ impl TreeWalker {
None => {
let mut candidate = DomRoot::from_ref(node);
while !self.is_root_node(&candidate) && candidate.GetNextSibling().is_none() {
match candidate.GetParentNode() {
None =>
// This can happen if the user set the current node to somewhere
// outside of the tree rooted at the original root.
return None,
Some(n) => candidate = n
}
// This can return None if the user set the current node to somewhere
// outside of the tree rooted at the original root.
candidate = candidate.GetParentNode()?;
}
if self.is_root_node(&candidate) {
None