aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
diff options
context:
space:
mode:
authorZack Slayton <zack.slayton@gmail.com>2015-03-08 18:55:52 -0400
committerZack Slayton <zack.slayton@gmail.com>2015-03-10 09:18:55 -0400
commit08ac0766eda2340008642e86799ea2cb1ef6e59f (patch)
treee53ed9f42ff9fa45603fa04ec0d772430ee7fd1e /components/script/dom/node.rs
parent09c36de8f1db54fdd2514f4b66c3a3753719a1bb (diff)
downloadservo-08ac0766eda2340008642e86799ea2cb1ef6e59f.tar.gz
servo-08ac0766eda2340008642e86799ea2cb1ef6e59f.zip
Use new `if let` syntax wherever possible. Fixes #4153.
Diffstat (limited to 'components/script/dom/node.rs')
-rw-r--r--components/script/dom/node.rs36
1 files changed, 15 insertions, 21 deletions
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index b6f4e86307b..cd9dc6e6098 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -1284,9 +1284,10 @@ impl Node {
}
// Step 3.
- match child {
- Some(child) if !parent.is_parent_of(child) => return Err(NotFound),
- _ => ()
+ if let Some(child) = child {
+ if !parent.is_parent_of(child) {
+ return Err(NotFound);
+ }
}
// Step 4-5.
@@ -1325,14 +1326,11 @@ impl Node {
if !parent.child_elements().is_empty() {
return Err(HierarchyRequest);
}
- match child {
- Some(child) => {
- if child.inclusively_following_siblings()
- .any(|child| child.is_doctype()) {
- return Err(HierarchyRequest)
- }
+ if let Some(child) = child {
+ if child.inclusively_following_siblings()
+ .any(|child| child.is_doctype()) {
+ return Err(HierarchyRequest);
}
- _ => (),
}
},
// Step 6.1.1(a)
@@ -1344,14 +1342,11 @@ impl Node {
if !parent.child_elements().is_empty() {
return Err(HierarchyRequest);
}
- match child {
- Some(ref child) => {
- if child.inclusively_following_siblings()
- .any(|child| child.is_doctype()) {
- return Err(HierarchyRequest)
- }
+ if let Some(ref child) = child {
+ if child.inclusively_following_siblings()
+ .any(|child| child.is_doctype()) {
+ return Err(HierarchyRequest);
}
- _ => (),
}
},
// Step 6.3
@@ -2368,12 +2363,11 @@ impl<'a> DisabledStateHelpers for JSRef<'a, Node> {
fn check_parent_disabled_state_for_option(self) {
if self.get_disabled_state() { return; }
- match self.parent_node().root() {
- Some(ref parent) if parent.r().is_htmloptgroupelement() && parent.r().get_disabled_state() => {
+ if let Some(ref parent) = self.parent_node().root() {
+ if parent.r().is_htmloptgroupelement() && parent.r().get_disabled_state() {
self.set_disabled_state(true);
self.set_enabled_state(false);
- },
- _ => ()
+ }
}
}