diff --git a/src/check.rs b/src/check.rs index 20aade9..c732f1e 100644 --- a/src/check.rs +++ b/src/check.rs @@ -64,23 +64,32 @@ pub fn player_name>(name: S) -> PlayerCheck { let mut err_vec = Vec::::new(); if name.len() < NAME_MIN.with(|n| *n.borrow()) { - err_vec.push(format!( - "{} character minimum", - NAME_MIN.with(|n| *n.borrow()) - )); + err_vec.push( + [ + &NAME_MIN.with(|n| *n.borrow()).to_string(), + " character minimum", + ] + .concat(), + ); } else if name.len() > NAME_MAX.with(|n| *n.borrow()) { - err_vec.push(format!( - "{} character maximum", - NAME_MAX.with(|n| *n.borrow()) - )); + err_vec.push( + [ + &NAME_MAX.with(|n| *n.borrow()).to_string(), + " character maximum" + ] + .concat() + ); } for c in name.chars() { if !NAME_CHARS.with(|n| *n.borrow()).contains(&c.to_string()) { - err_vec.push(format!( - "Allowed characters are: {}", - NAME_CHARS.with(|n| *n.borrow()) - )); + err_vec.push( + [ + "Allowed characters are: ", + &NAME_CHARS.with(|n| *n.borrow()) + ] + .concat() + ); break; } } @@ -98,23 +107,32 @@ pub fn player_password>(password: S) -> PlayerCheck { let mut err_vec = Vec::::new(); if password.len() < PASS_MIN.with(|p| *p.borrow()) { - err_vec.push(format!( - "{} character minimum", - PASS_MIN.with(|p| *p.borrow()) - )); + err_vec.push( + [ + &PASS_MIN.with(|p| *p.borrow()).to_string(), + " character minimum" + ] + .concat() + ); } else if password.len() > PASS_MAX.with(|p| *p.borrow()) { - err_vec.push(format!( - "{} character maximum", - PASS_MAX.with(|p| *p.borrow()) - )); + err_vec.push( + [ + &PASS_MAX.with(|p| *p.borrow()).to_string(), + " character maximum" + ] + .concat() + ); } for c in password.chars() { if !PASS_CHARS.with(|p| *p.borrow()).contains(&c.to_string()) { - err_vec.push(format!( - "Allowed characters are: {}", - PASS_CHARS.with(|p| *p.borrow()) - )); + err_vec.push( + [ + "Allowed characters are: ", + &PASS_CHARS.with(|p| *p.borrow()).to_string() + ] + .concat() + ); break; } } diff --git a/src/command/dispatch/say.rs b/src/command/dispatch/say.rs index 1bef846..946c96f 100644 --- a/src/command/dispatch/say.rs +++ b/src/command/dispatch/say.rs @@ -19,9 +19,9 @@ impl Command { send_queue.push( neighbor_token, if neighbor_token == token { - format!("You say, \"{}\"\n", args) + ["You say, \"", &args, "\"\n"].concat() } else { - format!("{} says, \"{}\"\n", player.name, args) + [&player.name, " says, \"", &args, "\"\n"].concat() }, true, None,