Skip to content

Commit

Permalink
lints
Browse files Browse the repository at this point in the history
  • Loading branch information
UkoeHB committed Feb 23, 2024
1 parent 5fae520 commit 636be39
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions renet/src/transport/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Box<dyn TransportSocket>>) -> Result<Self, std::io::Error> {
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() {
Expand Down Expand Up @@ -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,
Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion renetcode/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -265,6 +265,7 @@ impl NetcodeServer {
None
}

#[allow(clippy::too_many_arguments)]
fn handle_connection_request<'a>(
&mut self,
socket_id: usize,
Expand Down

0 comments on commit 636be39

Please sign in to comment.