feat: replace two cases of not using fun call on unwrapping

This commit is contained in:
CosminPerRam 2024-05-01 18:51:48 +03:00
parent c2f6a68648
commit 78b52c0d23
2 changed files with 2 additions and 2 deletions

View file

@ -378,7 +378,7 @@ impl StringDecoder for Utf8LengthPrefixedDecoder {
// Find the maximum length of the string // Find the maximum length of the string
let length = *data let length = *data
.first() .first()
.ok_or(PacketBad.context("Length of string not found"))?; .ok_or_else(|| PacketBad.context("Length of string not found"))?;
// Find the position of the delimiter in the data. If the delimiter is not // Find the position of the delimiter in the data. If the delimiter is not
// found, the length is returned. // found, the length is returned.

View file

@ -164,7 +164,7 @@ impl HttpClient {
let host = http_settings let host = http_settings
.hostname .hostname
.map(S::into) .map(S::into)
.unwrap_or(address.ip().to_string()); .unwrap_or_else(|| address.ip().to_string());
Ok(Self { Ok(Self {
client, client,