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 <sameo@linux.intel.com>
This commit is contained in:
Samuel Ortiz 2019-09-27 18:46:47 +02:00
parent c505cfae2b
commit 9a93f4f0a6

View File

@ -102,8 +102,8 @@ impl Headers {
Header::ContentLength => {
let try_numeric: Result<i32, std::num::ParseIntError> =
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)