perf: slightly optimize Vec usage

This commit is contained in:
2025-03-10 19:58:59 -04:00
parent 2b2cf1d069
commit b2d8618bba
7 changed files with 11 additions and 11 deletions

View File

@@ -109,11 +109,7 @@ fn id(_lua: &Lua, client: &Client) -> Result<i32> {
}
fn tab_list(_lua: &Lua, client: &Client) -> Result<Vec<Player>> {
let mut tab_list = Vec::new();
for (_, player_info) in client.tab_list() {
tab_list.push(Player::from(player_info));
}
Ok(tab_list)
Ok(client.tab_list().into_values().map(Player::from).collect())
}
fn username(_lua: &Lua, client: &Client) -> Result<String> {