diff options
author | Zack Slayton <zack.slayton@gmail.com> | 2015-03-08 18:55:52 -0400 |
---|---|---|
committer | Zack Slayton <zack.slayton@gmail.com> | 2015-03-10 09:18:55 -0400 |
commit | 08ac0766eda2340008642e86799ea2cb1ef6e59f (patch) | |
tree | e53ed9f42ff9fa45603fa04ec0d772430ee7fd1e /components/script/dom/htmlelement.rs | |
parent | 09c36de8f1db54fdd2514f4b66c3a3753719a1bb (diff) | |
download | servo-08ac0766eda2340008642e86799ea2cb1ef6e59f.tar.gz servo-08ac0766eda2340008642e86799ea2cb1ef6e59f.zip |
Use new `if let` syntax wherever possible. Fixes #4153.
Diffstat (limited to 'components/script/dom/htmlelement.rs')
-rw-r--r-- | components/script/dom/htmlelement.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/components/script/dom/htmlelement.rs b/components/script/dom/htmlelement.rs index f3528185211..98bcbd6d92e 100644 --- a/components/script/dom/htmlelement.rs +++ b/components/script/dom/htmlelement.rs @@ -126,9 +126,10 @@ impl<'a> HTMLElementMethods for JSRef<'a, HTMLElement> { // https://html.spec.whatwg.org/multipage/interaction.html#dom-click fn Click(self) { let maybe_input: Option<JSRef<HTMLInputElement>> = HTMLInputElementCast::to_ref(self); - match maybe_input { - Some(i) if i.Disabled() => return, - _ => () + if let Some(i) = maybe_input { + if i.Disabled() { + return; + } } let element: JSRef<Element> = ElementCast::from_ref(self); // https://www.w3.org/Bugs/Public/show_bug.cgi?id=27430 ? @@ -188,9 +189,8 @@ impl<'a> VirtualMethods for JSRef<'a, HTMLElement> { } fn after_set_attr(&self, attr: JSRef<Attr>) { - match self.super_type() { - Some(ref s) => s.after_set_attr(attr), - _ => () + if let Some(ref s) = self.super_type() { + s.after_set_attr(attr); } let name = attr.local_name().as_slice(); |