option filters: is_none -> is_some
This commit is contained in:
parent
a2b86f2996
commit
fd3168e9f9
@ -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…
x
Reference in New Issue
Block a user