Add fixes based on review.

- Use if let instead of match for Option

- Refactor common code into pick_if_selected_and_reset
This commit is contained in:
Dongie Agnir 2015-10-27 15:20:35 -10:00
parent 92e008307f
commit 4849033297
2 changed files with 19 additions and 22 deletions

View file

@ -70,13 +70,12 @@ impl HTMLSelectElement {
}
}
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);
}
if let Some(last_selected) = last_selected {
last_selected.set_selectedness(true);
} else {
if self.display_size() == 1 {
if let Some(first_enabled) = first_enabled {
first_enabled.set_selectedness(true);
}
}
}