refactor(http1): updated Encoder/Decoder match with the matches macro (#2368)
This commit is contained in:
		| @@ -94,10 +94,7 @@ impl Decoder { | |||||||
|     // methods |     // methods | ||||||
|  |  | ||||||
|     pub fn is_eof(&self) -> bool { |     pub fn is_eof(&self) -> bool { | ||||||
|         match self.kind { |         matches!(self.kind, Length(0) | Chunked(ChunkedState::End, _) | Eof(true)) | ||||||
|             Length(0) | Chunked(ChunkedState::End, _) | Eof(true) => true, |  | ||||||
|             _ => false, |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     pub fn decode<R: MemRead>( |     pub fn decode<R: MemRead>( | ||||||
|   | |||||||
| @@ -68,10 +68,7 @@ impl Encoder { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     pub fn is_eof(&self) -> bool { |     pub fn is_eof(&self) -> bool { | ||||||
|         match self.kind { |         matches!(self.kind, Kind::Length(0)) | ||||||
|             Kind::Length(0) => true, |  | ||||||
|             _ => false, |  | ||||||
|         } |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     #[cfg(feature = "server")] |     #[cfg(feature = "server")] | ||||||
|   | |||||||
| @@ -202,12 +202,9 @@ impl Accept for AddrIncoming { | |||||||
| /// The timeout is useful to handle resource exhaustion errors like ENFILE | /// The timeout is useful to handle resource exhaustion errors like ENFILE | ||||||
| /// and EMFILE. Otherwise, could enter into tight loop. | /// and EMFILE. Otherwise, could enter into tight loop. | ||||||
| fn is_connection_error(e: &io::Error) -> bool { | fn is_connection_error(e: &io::Error) -> bool { | ||||||
|     match e.kind() { |     matches!(e.kind(), io::ErrorKind::ConnectionRefused | ||||||
|         io::ErrorKind::ConnectionRefused |  | ||||||
|         | io::ErrorKind::ConnectionAborted |         | io::ErrorKind::ConnectionAborted | ||||||
|         | io::ErrorKind::ConnectionReset => true, |         | io::ErrorKind::ConnectionReset) | ||||||
|         _ => false, |  | ||||||
|     } |  | ||||||
| } | } | ||||||
|  |  | ||||||
| impl fmt::Debug for AddrIncoming { | impl fmt::Debug for AddrIncoming { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user