From 8755b0a76e0822d1432dcf7f304c975f460d845b Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Thu, 3 Nov 2022 21:53:03 +0000 Subject: [PATCH] Simplify if unwrapping. --- src/main.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1832e3a..e2cf4f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -157,10 +157,7 @@ async fn index(req: HttpRequest) -> Result> { } } - let content_type = resp.headers().get("content-type"); - - if content_type.is_some() { - let content_type = content_type.unwrap(); + if let Some(content_type) = resp.headers().get("content-type") { if content_type == "image/jpeg" { let resp_bytes = resp.bytes().await.unwrap();