perf: use of ok_or followed by a function call

This commit is contained in:
CosminPerRam 2023-12-11 03:53:18 +02:00
parent e1bffd2045
commit 9c3e6cb51f
3 changed files with 3 additions and 3 deletions

View file

@ -90,7 +90,7 @@ pub fn query_with_timeout(
let packets = client.get_server_packets()?;
let data = packets
.get(0)
.ok_or(PacketBad.context("First packet missing"))?;
.ok_or_else(|| PacketBad.context("First packet missing"))?;
let (mut server_vars, remaining_data) = data_to_map(data)?;
let players = parse_players_and_teams(&remaining_data)?;