Remove unused loop

We only simulate a single connection in the test function `serve_tcp`.
Remove the unused loop (includes an unconditional break after first
iteration) and use `next` directly.

Found by clippy. Refactor only, no logic changes.
This commit is contained in:
Tobin C. Harding 2022-06-07 14:42:54 +10:00
parent 380e0016cc
commit 04b09a4e8d
1 changed files with 8 additions and 11 deletions

View File

@ -203,9 +203,8 @@ mod test {
// 2. Spawning thread that will be writing our messages to the TCP Stream at the server side // 2. Spawning thread that will be writing our messages to the TCP Stream at the server side
// in async mode // in async mode
let handle = thread::spawn(move || { let handle = thread::spawn(move || {
for ostream in listener.incoming() { // We only simulate a single connection.
let mut ostream = ostream.unwrap(); let mut ostream = listener.incoming().next().unwrap().unwrap();
for piece in pieces { for piece in pieces {
ostream.write_all(&piece[..]).unwrap(); ostream.write_all(&piece[..]).unwrap();
ostream.flush().unwrap(); ostream.flush().unwrap();
@ -213,8 +212,6 @@ mod test {
} }
ostream.shutdown(Shutdown::Both).unwrap(); ostream.shutdown(Shutdown::Both).unwrap();
break;
}
}); });
// 3. Creating client side of the TCP socket connection // 3. Creating client side of the TCP socket connection