From dfd76c321840979a2f0d5983a5da8ccae5fb9e80 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Fri, 16 Apr 2021 23:45:02 -0400 Subject: [PATCH] Remove now un-needed trim --- src/main.rs | 4 ---- src/slicesubsequence.rs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 51ed9c1..4e13a15 100644 --- a/src/main.rs +++ b/src/main.rs @@ -30,8 +30,6 @@ use stanzafilter::*; const IN_BUFFER_SIZE: usize = 8192; const OUT_BUFFER_SIZE: usize = 8192; -pub const WHITESPACE: &[u8] = b" \t\n\r"; - #[cfg(debug_assertions)] fn c2s(is_c2s: bool) -> &'static str { if is_c2s { @@ -160,7 +158,6 @@ async fn handle_connection(mut stream: tokio::net::TcpStream, client_addr: Socke while let Ok(Some(buf)) = in_rd.next(&mut in_filter).await { debug!("received pre-tls stanza: {} '{}'", client_addr, to_str(&buf)); - let buf = buf.trim_start(WHITESPACE); if buf.starts_with(b" {} '{}'", client_addr, to_str(&buf)); in_wr.write_all(&buf).await?; @@ -218,7 +215,6 @@ async fn handle_connection(mut stream: tokio::net::TcpStream, client_addr: Socke while let Ok(Some(buf)) = in_rd.next(&mut in_filter).await { debug!("received pre- stanza: {} '{}'", client_addr, to_str(&buf)); - let buf = buf.trim_start(WHITESPACE); if buf.starts_with(b" SliceSubsequence for Vec { #[cfg(test)] mod tests { use crate::slicesubsequence::*; - use crate::WHITESPACE; + const WHITESPACE: &[u8] = b" \t\n\r"; #[test] fn trim_start() {