diff --git a/tokio-postgres/src/connect.rs b/tokio-postgres/src/connect.rs index db2ddc85..f529ddbb 100644 --- a/tokio-postgres/src/connect.rs +++ b/tokio-postgres/src/connect.rs @@ -25,14 +25,15 @@ where let mut error = None; for (i, host) in config.host.iter().enumerate() { - let port = *config + let port = config .port .get(i) .or_else(|| config.port.get(0)) - .unwrap_or(&5432); + .copied() + .unwrap_or(5432); let hostname = match host { - Host::Tcp(host) => &**host, + Host::Tcp(host) => host.as_str(), // postgres doesn't support TLS over unix sockets, so the choice here doesn't matter #[cfg(unix)] Host::Unix(_) => "",