From 6fb8571f2834ec301bb2f5c4ef8db69c20fb24a4 Mon Sep 17 00:00:00 2001 From: Jose Torres Date: Thu, 25 Jun 2026 20:10:19 -0400 Subject: [PATCH] style(headers): small refactor to remove question_mark lint --- Cargo.toml | 1 - src/headers.rs | 12 +++++------- 2 files changed, 5 insertions(+), 8 deletions(-) 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; } }