From 2d19be25d970e2dd876b1091c10870697ff74cf3 Mon Sep 17 00:00:00 2001 From: rasul Date: Tue, 23 Jun 2020 16:13:01 -0500 Subject: [PATCH] change format! to concat() and modify listen() to take &String instead of String --- src/game/new.rs | 4 ++-- src/server.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/new.rs b/src/game/new.rs index 2908952..4433ac1 100644 --- a/src/game/new.rs +++ b/src/game/new.rs @@ -36,8 +36,8 @@ impl Game { tokens.push_back(Token(i)); } - let server_address = format!("{}:{}", config.server.ip, config.server.port); - let mut server = Server::listen(server_address.clone(), Token(0))?; + let server_address = [&config.server.ip, ":", &config.server.port.to_string()].concat(); + let mut server = Server::listen(&server_address, Token(0))?; info!("Listening on {}", &server_address); let poll = try_log!(Poll::new(), "Unable to create Poll"); diff --git a/src/server.rs b/src/server.rs index 8f02a44..439183d 100644 --- a/src/server.rs +++ b/src/server.rs @@ -27,7 +27,7 @@ pub struct Server { impl Server { /// Bind to the provided address - pub fn listen<'a>(addr: String, token: Token) -> RudeResult { + pub fn listen<'a>(addr: &String, token: Token) -> RudeResult { let addr: SocketAddr = try_log!(addr.parse(), "Unable to parse server address: {}", &addr); let socket: TcpListener = try_log!(