aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlselectelement.rs
diff options
context:
space:
mode:
authorDongie Agnir <dongie.agnir@gmail.com>2015-10-24 19:10:52 -1000
committerDongie Agnir <dongie.agnir@gmail.com>2015-10-24 19:10:52 -1000
commitb5e991c89e11be2467b30d1212052c57e21c81d6 (patch)
tree9b7344cfcf75f803dd698619e547786ddb005a51 /components/script/dom/htmlselectelement.rs
parentfcfc3918a4e53931ef8cd61a1f6a51d9bfc2e20f (diff)
downloadservo-b5e991c89e11be2467b30d1212052c57e21c81d6.tar.gz
servo-b5e991c89e11be2467b30d1212052c57e21c81d6.zip
Replace if-else with match.
Diffstat (limited to 'components/script/dom/htmlselectelement.rs')
-rw-r--r--components/script/dom/htmlselectelement.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/components/script/dom/htmlselectelement.rs b/components/script/dom/htmlselectelement.rs
index d1f3fc98c7d..20e473b88c9 100644
--- a/components/script/dom/htmlselectelement.rs
+++ b/components/script/dom/htmlselectelement.rs
@@ -70,16 +70,15 @@ impl HTMLSelectElement {
}
}
- if last_selected.is_none() {
- if self.display_size() == 1 {
- // select the first enabled element
- if let Some(first_opt) = first_enabled {
- first_opt.set_selectedness(true);
+ match last_selected {
+ Some(last_selected) => last_selected.set_selectedness(true),
+ None => {
+ if self.display_size() == 1 {
+ if let Some(first_enabled) = first_enabled {
+ first_enabled.set_selectedness(true);
+ }
}
}
- } else {
- // >= 1 selected, reselect last one
- last_selected.unwrap().set_selectedness(true);
}
}