slightly more efficient if else structure

This commit is contained in:
djaidjai committed 2023-05-09 17:58:11 +02:00
1 parent 3d64405349
commit d6438e30f2
1 file changed
+3 -4
+3 -4
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;
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.