Browse Source

andy vs. clippy round 3

pull/49/head
andy 4 years ago
parent
commit
e6cf819bf4
  1. 7
      src/ship/packet/handler/room.rs

7
src/ship/packet/handler/room.rs

@ -35,8 +35,7 @@ pub fn create_room(id: ClientId,
return Ok(Box::new(vec![(id, SendShipPacket::SmallDialog(SmallDialog::new("You must be at least level 20 \nto create Hard rooms.".into())))].into_iter())) return Ok(Box::new(vec![(id, SendShipPacket::SmallDialog(SmallDialog::new("You must be at least level 20 \nto create Hard rooms.".into())))].into_iter()))
} }
}, },
// i can't believe you've done this
_ => {unreachable!()},
room::Difficulty::Normal => {},
}; };
let area = client_location.get_area(id).unwrap(); let area = client_location.get_area(id).unwrap();
@ -87,9 +86,7 @@ pub fn join_room(id: ClientId,
-> Result<Box<dyn Iterator<Item=(ClientId, SendShipPacket)> + Send>, ShipError> { -> Result<Box<dyn Iterator<Item=(ClientId, SendShipPacket)> + Send>, ShipError> {
let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?; let client = clients.get(&id).ok_or(ShipError::ClientNotFound(id))?;
let level = level_table.get_level_from_exp(client.character.char_class, client.character.exp); let level = level_table.get_level_from_exp(client.character.char_class, client.character.exp);
let room = rooms.get(pkt.item as usize)
.ok_or_else(|| ShipError::InvalidRoom(pkt.item))?.as_ref()
.ok_or_else(|| ShipError::InvalidRoom(pkt.item))?;
let room = rooms.get(pkt.item as usize).ok_or(ShipError::InvalidRoom(pkt.item))?.as_ref().unwrap(); // clippy look what you made me do
match room.mode.difficulty() { match room.mode.difficulty() {
room::Difficulty::Ultimate => { room::Difficulty::Ultimate => {

Loading…
Cancel
Save