aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorMatt Brubeck <mbrubeck@limpet.net>2017-10-20 08:25:35 -0700
committerMatt Brubeck <mbrubeck@limpet.net>2017-10-20 08:25:35 -0700
commit2d45e9d2da571e70deef137f9022de87cc1126f3 (patch)
treed4f91108a958e80e06110c9437fea132785e8d85 /components/script/dom/node.rs
parentfe16c1d5c3c9084da0ccb85af599d6ec0f8ab20b (diff)
downloadservo-2d45e9d2da571e70deef137f9022de87cc1126f3.tar.gz
servo-2d45e9d2da571e70deef137f9022de87cc1126f3.zip
Use try syntax for Option where appropriate
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs26
1 files changed, 5 insertions, 21 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 2e05eb30971..8f29298a496 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -1206,11 +1206,7 @@ pub struct FollowingNodeIterator {
impl FollowingNodeIterator {
/// Skips iterating the children of the current node
pub fn next_skipping_children(&mut self) -> Option<DomRoot<Node>> {
- let current = match self.current.take() {
- None => return None,
- Some(current) => current,
- };
-
+ let current = self.current.take()?;
self.next_skipping_children_impl(current)
}
@@ -1244,10 +1240,7 @@ impl Iterator for FollowingNodeIterator {
// https://dom.spec.whatwg.org/#concept-tree-following
fn next(&mut self) -> Option<DomRoot<Node>> {
- let current = match self.current.take() {
- None => return None,
- Some(current) => current,
- };
+ let current = self.current.take()?;
if let Some(first_child) = current.GetFirstChild() {
self.current = Some(first_child);
@@ -1268,10 +1261,7 @@ impl Iterator for PrecedingNodeIterator {
// https://dom.spec.whatwg.org/#concept-tree-preceding
fn next(&mut self) -> Option<DomRoot<Node>> {
- let current = match self.current.take() {
- None => return None,
- Some(current) => current,
- };
+ let current = self.current.take()?;
self.current = if self.root == current {
None
@@ -1323,10 +1313,7 @@ impl TreeIterator {
}
pub fn next_skipping_children(&mut self) -> Option<DomRoot<Node>> {
- let current = match self.current.take() {
- None => return None,
- Some(current) => current,
- };
+ let current = self.current.take()?;
self.next_skipping_children_impl(current)
}
@@ -1353,10 +1340,7 @@ impl Iterator for TreeIterator {
// https://dom.spec.whatwg.org/#concept-tree-order
fn next(&mut self) -> Option<DomRoot<Node>> {
- let current = match self.current.take() {
- None => return None,
- Some(current) => current,
- };
+ let current = self.current.take()?;
if let Some(first_child) = current.GetFirstChild() {
self.current = Some(first_child);
self.depth += 1;