diff --git a/Cargo.toml b/Cargo.toml index beb8225c4d..e8a58b3a65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -140,7 +140,6 @@ needless_continue = "allow" needless_pass_by_value = "allow" panic = "allow" pattern_type_mismatch = "allow" -question_mark = "allow" # TODO: probably easy fix redundant_closure_for_method_calls = "allow" redundant_else = "allow" ref_patterns = "allow" # TODO: perhaps deny? diff --git a/src/headers.rs b/src/headers.rs index 509f089992..0b36e060f0 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -51,13 +51,11 @@ pub(super) fn content_length_parse_all_values(values: ValueIter<'_, HeaderValue> for h in values { if let Ok(line) = h.to_str() { for v in line.split(',') { - if let Some(n) = from_digits(v.trim().as_bytes()) { - if content_length.is_none() { - content_length = Some(n); - } else if content_length != Some(n) { - return None; - } - } else { + let n = from_digits(v.trim().as_bytes())?; + + if content_length.is_none() { + content_length = Some(n); + } else if content_length != Some(n) { return None; } }