From 14bee47e58bb15a9ac8eee01da33169270b33956 Mon Sep 17 00:00:00 2001 From: Christoffer Lantz Date: Fri, 26 Jul 2019 16:38:31 +0200 Subject: [PATCH] Applied cargo fmt --- server/src/cmd.rs | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/server/src/cmd.rs b/server/src/cmd.rs index d51d6b111a..15eeb6f1a4 100644 --- a/server/src/cmd.rs +++ b/server/src/cmd.rs @@ -3,19 +3,20 @@ //! and provide a handler function. use crate::Server; +use chrono::{NaiveTime, Timelike}; use common::{ comp, msg::ServerMsg, npc::{get_npc_name, NpcKind}, state::TimeOfDay, }; -use chrono::{NaiveTime, Timelike}; use rand::Rng; use specs::{Builder, Entity as EcsEntity, Join}; use vek::*; use lazy_static::lazy_static; use scan_fmt::scan_fmt; + /// Struct representing a command that a user can run from server chat. pub struct ChatCommand { /// The keyword used to invoke the command, omitting the leading '/'. @@ -210,8 +211,7 @@ fn handle_kill(server: &mut Server, entity: EcsEntity, _args: String, _action: & fn handle_time(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) { let time = scan_fmt!(&args, action.arg_fmt, String); - let new_time = match time.as_ref().map(|s| s.as_str()) - { + let new_time = match time.as_ref().map(|s| s.as_str()) { Some("night") => NaiveTime::from_hms(0, 0, 0), Some("dawn") => NaiveTime::from_hms(5, 0, 0), Some("day") => NaiveTime::from_hms(12, 0, 0), @@ -221,12 +221,13 @@ fn handle_time(server: &mut Server, entity: EcsEntity, args: String, action: &Ch Err(_) => match NaiveTime::parse_from_str(n, "%H:%M") { Ok(time) => time, Err(_) => { - server - .clients - .notify(entity, ServerMsg::private(format!("'{}' is not a valid time.", n))); + server.clients.notify( + entity, + ServerMsg::private(format!("'{}' is not a valid time.", n)), + ); return; } - } + }, }, None => { server.clients.notify( @@ -237,11 +238,15 @@ fn handle_time(server: &mut Server, entity: EcsEntity, args: String, action: &Ch } }; - server.state.ecs_mut().write_resource::().0 = new_time.num_seconds_from_midnight() as f64; + server.state.ecs_mut().write_resource::().0 = + new_time.num_seconds_from_midnight() as f64; server.clients.notify( entity, - ServerMsg::private(format!("Time changed to: {}", new_time.format("%H:%M").to_string())) + ServerMsg::private(format!( + "Time changed to: {}", + new_time.format("%H:%M").to_string() + )), ); } @@ -579,6 +584,7 @@ fn handle_light(server: &mut Server, entity: EcsEntity, args: String, action: &C .notify(entity, ServerMsg::chat(format!("You have no position!"))); } } + fn handle_lantern(server: &mut Server, entity: EcsEntity, _args: String, _action: &ChatCommand) { if server .state @@ -615,6 +621,7 @@ fn handle_lantern(server: &mut Server, entity: EcsEntity, _args: String, _action ); } } + fn handle_tell(server: &mut Server, entity: EcsEntity, args: String, action: &ChatCommand) { let opt_alias = scan_fmt!(&args, action.arg_fmt, String); match opt_alias {