From 7a3f0db3bf549b338b619172e3c35817f0c5c13c Mon Sep 17 00:00:00 2001 From: Andy Newjack Date: Thu, 30 Apr 2020 19:30:17 -0300 Subject: [PATCH] try if-let --- src/ship/ship.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ship/ship.rs b/src/ship/ship.rs index e1c61a6..cc21d87 100644 --- a/src/ship/ship.rs +++ b/src/ship/ship.rs @@ -336,9 +336,9 @@ impl ServerState for ShipServerState { let pkt = match self.client_location.get_area(id).unwrap() { RoomLobby::Room(room) => { - self.client_location.get_client_neighbors(id).map(|x| if x.len() == 0 { - self.rooms[room.0] = None - }); + if let 0 = neighbors.len() { + self.rooms[room.0] = None; + } let leader = self.client_location.get_room_leader(room).unwrap(); SendShipPacket::LeaveRoom(LeaveRoom::new(client.local_client.id(), leader.local_client.id())) },