From abfeb32e35a219a1095c49fe53245d9df06d71a3 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Tue, 7 Jun 2022 14:45:25 +1000 Subject: [PATCH] Remove unnecessary local variable In test functions; we bind to `istream` only to re-bind immediately to `stream`, this is unnecessary and adds no additional information to the code. --- src/network/stream_reader.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/network/stream_reader.rs b/src/network/stream_reader.rs index 6a79dd44..db472e2a 100644 --- a/src/network/stream_reader.rs +++ b/src/network/stream_reader.rs @@ -225,11 +225,10 @@ mod test { #[test] fn read_multipartmsg_test() { // Setting up TCP connection emulation - let (handle, istream) = serve_tcp(vec![ + let (handle, stream) = serve_tcp(vec![ // single message split in two parts to emulate real network conditions MSG_VERSION[..24].to_vec(), MSG_VERSION[24..].to_vec() ]); - let stream = istream; let mut reader = StreamReader::new(stream, None); // Reading and checking the whole message back @@ -243,13 +242,12 @@ mod test { #[test] fn read_sequencemsg_test() { // Setting up TCP connection emulation - let (handle, istream) = serve_tcp(vec![ + let (handle, stream) = serve_tcp(vec![ // Real-world Bitcoin core communication case for /Satoshi:0.17.1/ MSG_VERSION[..23].to_vec(), MSG_VERSION[23..].to_vec(), MSG_VERACK.to_vec(), MSG_ALERT[..24].to_vec(), MSG_ALERT[24..].to_vec() ]); - let stream = istream; let mut reader = StreamReader::new(stream, None); // Reading and checking the first message (Version)