Skip to content

Commit cd31c02

Browse files
authored
Merge pull request #657 from botika/master
Clean code at connect function
2 parents 4237843 + a2ca75e commit cd31c02

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tokio-postgres/src/connect.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,15 @@ where
2525

2626
let mut error = None;
2727
for (i, host) in config.host.iter().enumerate() {
28-
let port = *config
28+
let port = config
2929
.port
3030
.get(i)
3131
.or_else(|| config.port.get(0))
32-
.unwrap_or(&5432);
32+
.copied()
33+
.unwrap_or(5432);
3334

3435
let hostname = match host {
35-
Host::Tcp(host) => &**host,
36+
Host::Tcp(host) => host.as_str(),
3637
// postgres doesn't support TLS over unix sockets, so the choice here doesn't matter
3738
#[cfg(unix)]
3839
Host::Unix(_) => "",

0 commit comments

Comments
 (0)