From de8a04fc1f43ed946aea3b6ac6fdd102dc7a03be Mon Sep 17 00:00:00 2001 From: Nakaryo Date: Sun, 30 Aug 2026 15:01:29 +0900 Subject: [PATCH] refactor(http1): resolve collapsible_match lint Collapse the nested `if` inside the `Version::HTTP_11` match arm into a match guard. Refs #4071 --- Cargo.toml | 1 - src/proto/h1/conn.rs | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b50b8d6c13..67594976d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -118,7 +118,6 @@ as_conversions = "allow" # TODO: tricky cast_possible_truncation = "allow" # TODO: consider cast_precision_loss = "allow" # TODO: consider checked_conversions = "allow" -collapsible_match = "allow" else_if_without_else = "allow" enum_glob_use = "allow" float_arithmetic = "allow" diff --git a/src/proto/h1/conn.rs b/src/proto/h1/conn.rs index 19c1283df7..593d3d9eda 100644 --- a/src/proto/h1/conn.rs +++ b/src/proto/h1/conn.rs @@ -676,11 +676,9 @@ where Version::HTTP_10 => self.state.disable_keep_alive(), // If response is version 1.1 and keep-alive is wanted, add // Connection: keep-alive header when not present - Version::HTTP_11 => { - if self.state.wants_keep_alive() { - head.headers - .insert(CONNECTION, HeaderValue::from_static("keep-alive")); - } + Version::HTTP_11 if self.state.wants_keep_alive() => { + head.headers + .insert(CONNECTION, HeaderValue::from_static("keep-alive")); } _ => (), }