mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Use try syntax for Option where appropriate
This commit is contained in:
parent
fe16c1d5c3
commit
2d45e9d2da
19 changed files with 65 additions and 180 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue