diff --git a/crates/lib/src/buffer.rs b/crates/lib/src/buffer.rs index 1a0c0aa..967ed4a 100644 --- a/crates/lib/src/buffer.rs +++ b/crates/lib/src/buffer.rs @@ -378,7 +378,7 @@ impl StringDecoder for Utf8LengthPrefixedDecoder { // Find the maximum length of the string let length = *data .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 // found, the length is returned. diff --git a/crates/lib/src/http.rs b/crates/lib/src/http.rs index aa5eaf9..7986339 100644 --- a/crates/lib/src/http.rs +++ b/crates/lib/src/http.rs @@ -164,7 +164,7 @@ impl HttpClient { let host = http_settings .hostname .map(S::into) - .unwrap_or(address.ip().to_string()); + .unwrap_or_else(|| address.ip().to_string()); Ok(Self { client,