Browse Source

try if-let

pbs
Andy Newjack 5 years ago
parent
commit
7a3f0db3bf
  1. 6
      src/ship/ship.rs

6
src/ship/ship.rs

@ -336,9 +336,9 @@ impl<EG: EntityGateway> ServerState for ShipServerState<EG> {
let pkt = match self.client_location.get_area(id).unwrap() { let pkt = match self.client_location.get_area(id).unwrap() {
RoomLobby::Room(room) => { 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(); let leader = self.client_location.get_room_leader(room).unwrap();
SendShipPacket::LeaveRoom(LeaveRoom::new(client.local_client.id(), leader.local_client.id())) SendShipPacket::LeaveRoom(LeaveRoom::new(client.local_client.id(), leader.local_client.id()))
}, },

Loading…
Cancel
Save