From 9df9706010020d5434b0268fbbe23c2da3c9bfbb Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 17 Oct 2021 12:31:10 -0400 Subject: [PATCH] Use append in place of extend_from_slice in DataReaderImpl::add_data. Suggested by @cheako. --- crates/tor-proto/src/stream/data.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/tor-proto/src/stream/data.rs b/crates/tor-proto/src/stream/data.rs index 91aba6c87..3768fc195 100644 --- a/crates/tor-proto/src/stream/data.rs +++ b/crates/tor-proto/src/stream/data.rs @@ -418,7 +418,7 @@ impl DataReaderImpl { } /// Add the data from `d` to the end of our pending bytes. - fn add_data(&mut self, d: Vec) { + fn add_data(&mut self, mut d: Vec) { if self.buf_is_empty() { // No data pending? Just take d as the new pending. self.pending = d; @@ -427,7 +427,7 @@ impl DataReaderImpl { // XXXX This has potential to grow `pending` without // bound. Fortunately, we don't read data in this // (non-empty) case right now. - self.pending.extend_from_slice(&d[..]); + self.pending.append(&mut d); } } }