From 7818829760f9e10c6c6799bf551f3d7bfa55dbab Mon Sep 17 00:00:00 2001 From: "B. Blechschmidt" Date: Tue, 4 Apr 2023 00:19:41 +0200 Subject: [PATCH] Apply clippy fixes --- src/http.rs | 8 ++++---- src/socks5.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/http.rs b/src/http.rs index 0a5b320..a51f153 100644 --- a/src/http.rs +++ b/src/http.rs @@ -164,14 +164,14 @@ impl TcpProxy for HttpConnection { fn have_data(&mut self, dir: Direction) -> bool { match dir { Direction::Incoming(incoming) => match incoming { - IncomingDirection::FromServer => self.server_inbuf.len() > 0, + IncomingDirection::FromServer => !self.server_inbuf.is_empty(), IncomingDirection::FromClient => { - self.client_inbuf.len() > 0 || self.data_buf.len() > 0 + !self.client_inbuf.is_empty() || !self.data_buf.is_empty() } }, Direction::Outgoing(outgoing) => match outgoing { - OutgoingDirection::ToServer => self.server_outbuf.len() > 0, - OutgoingDirection::ToClient => self.client_outbuf.len() > 0, + OutgoingDirection::ToServer => !self.server_outbuf.is_empty(), + OutgoingDirection::ToClient => !self.client_outbuf.is_empty(), }, } } diff --git a/src/socks5.rs b/src/socks5.rs index c6d8c0a..7448146 100644 --- a/src/socks5.rs +++ b/src/socks5.rs @@ -372,14 +372,14 @@ impl TcpProxy for SocksConnection { fn have_data(&mut self, dir: Direction) -> bool { match dir { Direction::Incoming(incoming) => match incoming { - IncomingDirection::FromServer => self.server_inbuf.len() > 0, + IncomingDirection::FromServer => !self.server_inbuf.is_empty(), IncomingDirection::FromClient => { - self.client_inbuf.len() > 0 || self.data_buf.len() > 0 + !self.client_inbuf.is_empty() || !self.data_buf.is_empty() } }, Direction::Outgoing(outgoing) => match outgoing { - OutgoingDirection::ToServer => self.server_outbuf.len() > 0, - OutgoingDirection::ToClient => self.client_outbuf.len() > 0, + OutgoingDirection::ToServer => !self.server_outbuf.is_empty(), + OutgoingDirection::ToClient => !self.client_outbuf.is_empty(), }, } }