Skip to content

Commit de8a04f

Browse files
committed
refactor(http1): resolve collapsible_match lint
Collapse the nested `if` inside the `Version::HTTP_11` match arm into a match guard. Refs #4071
1 parent 7611e61 commit de8a04f

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ as_conversions = "allow" # TODO: tricky
118118
cast_possible_truncation = "allow" # TODO: consider
119119
cast_precision_loss = "allow" # TODO: consider
120120
checked_conversions = "allow"
121-
collapsible_match = "allow"
122121
else_if_without_else = "allow"
123122
enum_glob_use = "allow"
124123
float_arithmetic = "allow"

src/proto/h1/conn.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -676,11 +676,9 @@ where
676676
Version::HTTP_10 => self.state.disable_keep_alive(),
677677
// If response is version 1.1 and keep-alive is wanted, add
678678
// Connection: keep-alive header when not present
679-
Version::HTTP_11 => {
680-
if self.state.wants_keep_alive() {
681-
head.headers
682-
.insert(CONNECTION, HeaderValue::from_static("keep-alive"));
683-
}
679+
Version::HTTP_11 if self.state.wants_keep_alive() => {
680+
head.headers
681+
.insert(CONNECTION, HeaderValue::from_static("keep-alive"));
684682
}
685683
_ => (),
686684
}

0 commit comments

Comments
 (0)