Avoiding get reference of a u16

This commit is contained in:
Juan Aguilar Santillana 2020-09-20 10:37:15 +00:00
parent 4237843a0e
commit 391a54aea1

View File

@ -25,11 +25,12 @@ 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,