mirror of
https://github.com/servo/servo.git
synced 2025-06-21 15:49:04 +01:00
Replace if-else with match.
This commit is contained in:
parent
fcfc3918a4
commit
b5e991c89e
1 changed files with 7 additions and 8 deletions
|
@ -70,16 +70,15 @@ impl HTMLSelectElement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if last_selected.is_none() {
|
match last_selected {
|
||||||
if self.display_size() == 1 {
|
Some(last_selected) => last_selected.set_selectedness(true),
|
||||||
// select the first enabled element
|
None => {
|
||||||
if let Some(first_opt) = first_enabled {
|
if self.display_size() == 1 {
|
||||||
first_opt.set_selectedness(true);
|
if let Some(first_enabled) = first_enabled {
|
||||||
|
first_enabled.set_selectedness(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// >= 1 selected, reselect last one
|
|
||||||
last_selected.unwrap().set_selectedness(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue