Merge pull request #657 from botika/master
Clean code at connect function
This commit is contained in:
commit
cd31c02d77
@ -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(_) => "",
|
||||
|
Loading…
Reference in New Issue
Block a user