--- a/gameServer2/src/server/handlers/inroom.rs Wed Jun 27 02:34:46 2018 +0300
+++ b/gameServer2/src/server/handlers/inroom.rs Wed Jun 27 04:54:41 2018 +0300
@@ -42,14 +42,13 @@
const NON_TIMED_MESSAGES: &[u8] = b"M#hb";
fn is_msg_valid(msg: &[u8], team_indices: &[u8]) -> bool {
- if let [size, typ, body..] = msg {
- VALID_MESSAGES.contains(typ) &&
- match body {
+ match msg {
+ [size, typ, body..] => VALID_MESSAGES.contains(typ)
+ && match body {
[1...8, team, ..] if *typ == b'h' => team_indices.contains(team),
_ => *typ != b'h'
- }
- } else {
- false
+ },
+ _ => false
}
}