From ca1466d2e31cc78514de3889b918ae311925093a Mon Sep 17 00:00:00 2001 From: Max Inden Date: Mon, 15 Apr 2024 12:41:13 +0200 Subject: [PATCH] refactor(SendStream): remove duplicate buf.is_empty check (#1823) `SendStream::send_internal` starts off with a check to `buf.is_empty`. https://github.com/mozilla/neqo/blob/cf0009842dade14a52416180f94a2dc507cd867a/neqo-transport/src/send_stream.rs#L1252-L1256 Thus the following `buf.is_empty` check isn't necessary. https://github.com/mozilla/neqo/blob/cf0009842dade14a52416180f94a2dc507cd867a/neqo-transport/src/send_stream.rs#L1272 --- neqo-transport/src/send_stream.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/neqo-transport/src/send_stream.rs b/neqo-transport/src/send_stream.rs index 8771ec7765..1a73cc70be 100644 --- a/neqo-transport/src/send_stream.rs +++ b/neqo-transport/src/send_stream.rs @@ -1269,7 +1269,7 @@ impl SendStream { return Err(Error::FinalSizeError); } - let buf = if buf.is_empty() || (self.avail() == 0) { + let buf = if self.avail() == 0 { return Ok(0); } else if self.avail() < buf.len() { if atomic {