Browse Source

option filters: is_none -> is_some

pbs
jake 5 years ago
parent
commit
fd3168e9f9
  1. 6
      src/ship/location.rs

6
src/ship/location.rs

@ -192,7 +192,7 @@ impl ClientLocation {
let in_lobby = self.lobbies.iter() let in_lobby = self.lobbies.iter()
.any(|k| k.contains(id)); .any(|k| k.contains(id));
let in_room = self.rooms.iter() let in_room = self.rooms.iter()
.filter(|k| k.is_none())
.filter(|k| k.is_some())
.map(|k| k.unwrap()) .map(|k| k.unwrap())
.any(|k| k.contains(id)); .any(|k| k.contains(id));
@ -216,7 +216,7 @@ impl ClientLocation {
self.err_if_client_is_in_area(id, CreateRoomError::ClientInAreaAlready)?; self.err_if_client_is_in_area(id, CreateRoomError::ClientInAreaAlready)?;
let (room_id, empty_room) = self.rooms.iter_mut() let (room_id, empty_room) = self.rooms.iter_mut()
.enumerate() .enumerate()
.filter(|(_, k)| k.is_none())
.filter(|(_, k)| k.is_some())
.nth(0) .nth(0)
.ok_or(CreateRoomError::NoOpenSlots)?; .ok_or(CreateRoomError::NoOpenSlots)?;
@ -265,7 +265,7 @@ impl ClientLocation {
} }
self.rooms.iter_mut() self.rooms.iter_mut()
.filter(|lobby| lobby.is_none())
.filter(|lobby| lobby.is_some())
.map(|lobby| lobby.unwrap()) .map(|lobby| lobby.unwrap())
.map(|mut lobby| lobby.remove(id)) .map(|mut lobby| lobby.remove(id))
.any(|k| k); .any(|k| k);

Loading…
Cancel
Save