Skip to content

Commit

Permalink
rewrite uses of map as if let
Browse files Browse the repository at this point in the history
closes #7580
  • Loading branch information
jxs committed Sep 15, 2015
1 parent 97710f0 commit 832cfac
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions components/script/dom/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -798,12 +798,19 @@ impl Document {
match key {
Key::Space if !prevented && state == KeyState::Released => {
let maybe_elem: Option<&Element> = ElementCast::to_ref(target);
maybe_elem.map(
|el| el.as_maybe_activatable().map(|a| a.synthetic_click_activation(ctrl, alt, shift, meta)));
if let Some(el) = maybe_elem {
if let Some(a) = el.as_maybe_activatable() {
a.synthetic_click_activation(ctrl, alt, shift, meta);
}
}
}
Key::Enter if !prevented && state == KeyState::Released => {
let maybe_elem: Option<&Element> = ElementCast::to_ref(target);
maybe_elem.map(|el| el.as_maybe_activatable().map(|a| a.implicit_submission(ctrl, alt, shift, meta)));
if let Some(el) = maybe_elem {
if let Some(a) = el.as_maybe_activatable() {
a.implicit_submission(ctrl, alt, shift, meta);
}
}
}
_ => ()
}
Expand Down

0 comments on commit 832cfac

Please sign in to comment.