mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-12-22 21:55:20 +00:00
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:
parent
c505cfae2b
commit
9a93f4f0a6
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user