diff --git a/core/http/src/listener.rs b/core/http/src/listener.rs index 172d065f..65b84371 100644 --- a/core/http/src/listener.rs +++ b/core/http/src/listener.rs @@ -167,13 +167,11 @@ impl Accept for Incoming { /// The delay is useful to handle resource exhaustion errors like ENFILE /// and EMFILE. Otherwise, could enter into tight loop. fn is_connection_error(e: &io::Error) -> bool { - match e.kind() { + matches!(e.kind(), io::ErrorKind::ConnectionRefused | io::ErrorKind::ConnectionAborted | - io::ErrorKind::ConnectionReset => true, - _ => false, + io::ErrorKind::ConnectionReset) } -} impl fmt::Debug for Incoming { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { diff --git a/core/http/src/parse/checkers.rs b/core/http/src/parse/checkers.rs index a56a9bce..116b95b0 100644 --- a/core/http/src/parse/checkers.rs +++ b/core/http/src/parse/checkers.rs @@ -5,9 +5,6 @@ pub fn is_whitespace(&byte: &char) -> bool { #[inline] pub fn is_valid_token(&c: &char) -> bool { - match c { - '0'..='9' | 'A'..='Z' | '^'..='~' | '#'..='\'' - | '!' | '*' | '+' | '-' | '.' => true, - _ => false + matches!(c, '0'..='9' | 'A'..='Z' | '^'..='~' | '#'..='\'' + | '!' | '*' | '+' | '-' | '.') } -}