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.
This commit is contained in:
Tobin C. Harding 2022-06-07 14:45:25 +10:00
parent 04b09a4e8d
commit abfeb32e35
1 changed files with 2 additions and 4 deletions

View File

@ -225,11 +225,10 @@ mod test {
#[test] #[test]
fn read_multipartmsg_test() { fn read_multipartmsg_test() {
// Setting up TCP connection emulation // 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 // single message split in two parts to emulate real network conditions
MSG_VERSION[..24].to_vec(), MSG_VERSION[24..].to_vec() MSG_VERSION[..24].to_vec(), MSG_VERSION[24..].to_vec()
]); ]);
let stream = istream;
let mut reader = StreamReader::new(stream, None); let mut reader = StreamReader::new(stream, None);
// Reading and checking the whole message back // Reading and checking the whole message back
@ -243,13 +242,12 @@ mod test {
#[test] #[test]
fn read_sequencemsg_test() { fn read_sequencemsg_test() {
// Setting up TCP connection emulation // 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/ // Real-world Bitcoin core communication case for /Satoshi:0.17.1/
MSG_VERSION[..23].to_vec(), MSG_VERSION[23..].to_vec(), MSG_VERSION[..23].to_vec(), MSG_VERSION[23..].to_vec(),
MSG_VERACK.to_vec(), MSG_VERACK.to_vec(),
MSG_ALERT[..24].to_vec(), MSG_ALERT[24..].to_vec() MSG_ALERT[..24].to_vec(), MSG_ALERT[24..].to_vec()
]); ]);
let stream = istream;
let mut reader = StreamReader::new(stream, None); let mut reader = StreamReader::new(stream, None);
// Reading and checking the first message (Version) // Reading and checking the first message (Version)