From f8d75d900e9955fa846f0f7e18c45d5a76998886 Mon Sep 17 00:00:00 2001 From: sxv20_ Date: Tue, 16 Apr 2019 15:31:14 +0100 Subject: [PATCH] Clean up help message and if-let Former-commit-id: 450281467a92b2b8186df74d83d108457513277a --- server/src/lib.rs | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/server/src/lib.rs b/server/src/lib.rs index f3d455ebcc..e0f86e32a3 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -486,21 +486,20 @@ impl Server { .find(|(_, player)| player.alias == alias) .map(|(entity, _)| entity); match opt_player { - Some(player) => { - if let Some(pos) = - self.state.read_component_cloned::(player) - { - self.state.write_component(entity, pos); - } else { - self.clients.notify( - entity, - ServerMsg::Chat(format!( - "Unable to teleport to player '{}'", - alias - )), - ); - } - } + Some(player) => match self + .state + .read_component_cloned::(player) + { + Some(pos) => self.state.write_component(entity, pos), + None => self.clients.notify( + entity, + ServerMsg::Chat(format!( + "Unable to teleport to player '{}'", + alias + )), + ), + }, + None => { self.clients.notify( entity, @@ -531,7 +530,8 @@ impl Server { self.clients.notify( entity, ServerMsg::Chat(format!( - "Unrecognised command: '/{}'\nAvailable commands:", + "Unrecognised command: '/{}'\n + type '/help' for a list of available commands", kwd )), );