From 78b52c0d239e7876335cc2bf7eaccff702120d28 Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Wed, 1 May 2024 18:51:48 +0300 Subject: [PATCH] feat: replace two cases of not using fun call on unwrapping --- crates/lib/src/buffer.rs | 2 +- crates/lib/src/http.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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,