diff --git a/renet/src/transport/server.rs b/renet/src/transport/server.rs index 74ac09be..4702c319 100644 --- a/renet/src/transport/server.rs +++ b/renet/src/transport/server.rs @@ -26,7 +26,7 @@ impl NetcodeServerTransport { /// Multiple [`TransportSockets`](super::TransportSocket) may be inserted. Each socket must line /// up 1:1 with socket config entries in `ServerConfig::sockets`. pub fn new_with_sockets(server_config: ServerConfig, sockets: Vec>) -> Result { - if server_config.sockets.len() == 0 { + if server_config.sockets.is_empty() { panic!("netcode server transport must have at least 1 socket"); } if server_config.sockets.len() != sockets.len() { @@ -106,7 +106,7 @@ impl NetcodeServerTransport { match socket.try_recv(&mut self.buffer) { Ok((len, addr)) => { let server_result = self.netcode_server.process_packet(socket_id, addr, &mut self.buffer[..len]); - handle_server_result(server_result, socket_id, &mut socket, server); + handle_server_result(server_result, socket_id, socket, server); } Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => break, Err(ref e) if e.kind() == io::ErrorKind::Interrupted => break, @@ -117,12 +117,12 @@ impl NetcodeServerTransport { for client_id in self.netcode_server.clients_id() { let server_result = self.netcode_server.update_client(client_id); - handle_server_result(server_result, socket_id, &mut socket, server); + handle_server_result(server_result, socket_id, socket, server); } for disconnection_id in server.disconnections_id() { let server_result = self.netcode_server.disconnect(disconnection_id.raw()); - handle_server_result(server_result, socket_id, &mut socket, server); + handle_server_result(server_result, socket_id, socket, server); } socket.postupdate(); diff --git a/renetcode/src/server.rs b/renetcode/src/server.rs index 6d44849e..c5d98f10 100644 --- a/renetcode/src/server.rs +++ b/renetcode/src/server.rs @@ -141,7 +141,7 @@ pub struct ServerConfig { impl NetcodeServer { pub fn new(config: ServerConfig) -> Self { - if config.sockets.len() == 0 { + if config.sockets.is_empty() { panic!("Cannot make a server with no sockets."); } if config.max_clients > NETCODE_MAX_CLIENTS { @@ -265,6 +265,7 @@ impl NetcodeServer { None } + #[allow(clippy::too_many_arguments)] fn handle_connection_request<'a>( &mut self, socket_id: usize,