From 9a93f4f0a6e50011a5592d62bcd5b44ae31870c3 Mon Sep 17 00:00:00 2001 From: Samuel Ortiz Date: Fri, 27 Sep 2019 18:46:47 +0200 Subject: [PATCH] micro_http: Fix clippy warning Use a more idiomatic "let Ok(foo) = result" construct for: 105 | if try_numeric.is_ok() { | ------------------- the check is happening here 106 | self.content_length = try_numeric.unwrap(); | ^^^^^^^^^^^^^^^^^^^^ Signed-off-by: Samuel Ortiz --- micro_http/src/common/headers.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/micro_http/src/common/headers.rs b/micro_http/src/common/headers.rs index fabafe7f4..1bf5d53dd 100644 --- a/micro_http/src/common/headers.rs +++ b/micro_http/src/common/headers.rs @@ -102,8 +102,8 @@ impl Headers { Header::ContentLength => { let try_numeric: Result = std::str::FromStr::from_str(entry[1].trim()); - if try_numeric.is_ok() { - self.content_length = try_numeric.unwrap(); + if let Ok(content_length) = try_numeric { + self.content_length = content_length; Ok(()) } else { Err(RequestError::InvalidHeader)