Skip to content

Commit

Permalink
clippy: Use listener.incoming().flatten()
Browse files Browse the repository at this point in the history
  • Loading branch information
donovanglover committed Apr 7, 2024
1 parent 9e6596a commit 63dfee8
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ use urlencoding::decode;
pub fn start(address: SocketAddrV4) -> Result<(), std::io::Error> {
let listener = TcpListener::bind(address)?;

for maybe_stream in listener.incoming() {
if let Ok(stream) = maybe_stream {
thread::spawn(|| {
handle_connection(stream);
});
}
for stream in listener.incoming().flatten() {
thread::spawn(|| {
handle_connection(stream);
});
}

Ok(())
Expand Down

0 comments on commit 63dfee8

Please sign in to comment.