slightly more efficient if else structure

This commit is contained in:
Djairo Hougee 2023-05-09 17:58:11 +02:00
parent 3d64405349
commit d6438e30f2
1 changed files with 3 additions and 4 deletions

View File

@ -31,10 +31,9 @@ pub fn update_players(
}
}
if !active.is_empty() {
let cur = active.first_entry().unwrap().remove();
update_prefix(cfg, &mut data.display_prefix, cur.identity());
data.current_player = Some(cur);
if let Some((_, player)) = active.pop_first() {
update_prefix(cfg, &mut data.display_prefix, player.identity());
data.current_player = Some(player);
} else {
data.current_player = None;
}