From 6c0eb7a57d306aa2c94044067e68f216f572dd9f Mon Sep 17 00:00:00 2001 From: rasul Date: Tue, 7 Apr 2020 22:30:50 -0500 Subject: [PATCH] rustfmt --- src/game/check_player.rs | 10 ++++++++-- src/game/state/login.rs | 36 +++++++++++++++++------------------- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/src/game/check_player.rs b/src/game/check_player.rs index 0a3858a..3f5968d 100644 --- a/src/game/check_player.rs +++ b/src/game/check_player.rs @@ -25,7 +25,10 @@ impl Game { for c in name.chars() { if !self.config.player.name_chars.contains(&c.to_string()) { - err_vec.push(format!("Allowed characters are: {}", self.config.player.name_chars)); + err_vec.push(format!( + "Allowed characters are: {}", + self.config.player.name_chars + )); break; } } @@ -50,7 +53,10 @@ impl Game { for c in password.chars() { if !self.config.player.pass_chars.contains(&c.to_string()) { - err_vec.push(format!("Allowed characters are: {}", self.config.player.pass_chars)); + err_vec.push(format!( + "Allowed characters are: {}", + self.config.player.pass_chars + )); break; } } diff --git a/src/game/state/login.rs b/src/game/state/login.rs index b82661c..2e4eb4b 100644 --- a/src/game/state/login.rs +++ b/src/game/state/login.rs @@ -27,24 +27,22 @@ impl Game { send_queue.push(token, "\n\nUsername: ", false, None); } else { match self.check_player_name(message) { - PlayerCheck::Ok(name) => { - match self.db.find_player_by_name(&name) { - Ok(Some(_)) => { - send_queue.push(token, "\nPassword: ", false, None); - client.state = State::Login(Login::Password(name)); - } - Ok(None) => { - send_queue.push( - token, - format!("\nCreate {}? [y/N]: ", name), - false, - None, - ); - client.state = State::Login(Login::CreateUser(name)); - } - Err(_) => { - send_queue.push(token, "\nError\n\nUsername: ", false, None); - } + PlayerCheck::Ok(name) => match self.db.find_player_by_name(&name) { + Ok(Some(_)) => { + send_queue.push(token, "\nPassword: ", false, None); + client.state = State::Login(Login::Password(name)); + } + Ok(None) => { + send_queue.push( + token, + format!("\nCreate {}? [y/N]: ", name), + false, + None, + ); + client.state = State::Login(Login::CreateUser(name)); + } + Err(_) => { + send_queue.push(token, "\nError\n\nUsername: ", false, None); } }, PlayerCheck::Err(err) => { @@ -53,7 +51,7 @@ impl Game { send_queue.push(token, format!("{}\n", line), false, None); } send_queue.push(token, "\n\nUsername: ", false, None); - }, + } }; } }