diff --git a/src/lune/builtins/net/server.rs b/src/lune/builtins/net/server.rs index e00c2d5..97f22c7 100644 --- a/src/lune/builtins/net/server.rs +++ b/src/lune/builtins/net/server.rs @@ -21,14 +21,7 @@ use super::{ }; pub(super) fn bind_to_localhost(port: u16) -> LuaResult> { - let addr = match SocketAddr::try_from(([127, 0, 0, 1], port)) { - Ok(a) => a, - Err(e) => { - return Err(LuaError::external(format!( - "Failed to bind to localhost on port {port}\n{e}" - ))) - } - }; + let addr = SocketAddr::from(([127, 0, 0, 1], port)); match Server::try_bind(&addr) { Ok(b) => Ok(b), Err(e) => Err(LuaError::external(format!(