Skip to content

Commit 08c3416

Browse files
authored
style(headers): small refactor to remove question_mark lint (#4116)
1 parent aecf5ab commit 08c3416

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ needless_continue = "allow"
140140
needless_pass_by_value = "allow"
141141
panic = "allow"
142142
pattern_type_mismatch = "allow"
143-
question_mark = "allow" # TODO: probably easy fix
144143
redundant_closure_for_method_calls = "allow"
145144
redundant_else = "allow"
146145
ref_patterns = "allow" # TODO: perhaps deny?

src/headers.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ pub(super) fn content_length_parse_all_values(values: ValueIter<'_, HeaderValue>
5151
for h in values {
5252
if let Ok(line) = h.to_str() {
5353
for v in line.split(',') {
54-
if let Some(n) = from_digits(v.trim().as_bytes()) {
55-
if content_length.is_none() {
56-
content_length = Some(n);
57-
} else if content_length != Some(n) {
58-
return None;
59-
}
60-
} else {
54+
let n = from_digits(v.trim().as_bytes())?;
55+
56+
if content_length.is_none() {
57+
content_length = Some(n);
58+
} else if content_length != Some(n) {
6159
return None;
6260
}
6361
}

0 commit comments

Comments
 (0)