diff --git a/src/api.rs b/src/api.rs index 0ff6c3c..4feb786 100644 --- a/src/api.rs +++ b/src/api.rs @@ -33,15 +33,8 @@ pub(crate) struct Location { impl Location { pub(crate) fn get_endpoint(&self) -> anyhow::Result { - let endpoint_addr_with_port: String; - let endpoint_addr = if self.pool.contains(':') { - &self.pool - } else { - endpoint_addr_with_port = format!("{}:51820", self.pool); - &endpoint_addr_with_port - }; - let mut endpoints = endpoint_addr.to_socket_addrs()?; - endpoints + (self.pool.as_str(), 51820) + .to_socket_addrs()? .next() .ok_or_else(|| anyhow!("no valid endpoint address")) }