Skip to content

Commit 0fcd0c2

Browse files
author
Hirotaka Azuma
committed
Review fix: get_keepalives_{interval,retries} returns copied Option.
1 parent a97e17b commit 0fcd0c2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

postgres/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ impl Config {
293293
}
294294

295295
/// Gets the time interval between TCP keepalive probes.
296-
pub fn get_keepalives_interval(&self) -> Option<&Duration> {
296+
pub fn get_keepalives_interval(&self) -> Option<Duration> {
297297
self.config.get_keepalives_interval()
298298
}
299299

@@ -306,7 +306,7 @@ impl Config {
306306
}
307307

308308
/// Gets the maximum number of TCP keepalive probes that will be sent before dropping a connection.
309-
pub fn get_keepalives_retries(&self) -> Option<&u32> {
309+
pub fn get_keepalives_retries(&self) -> Option<u32> {
310310
self.config.get_keepalives_retries()
311311
}
312312

tokio-postgres/src/config.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,8 +377,8 @@ impl Config {
377377
}
378378

379379
/// Gets the time interval between TCP keepalive probes.
380-
pub fn get_keepalives_interval(&self) -> Option<&Duration> {
381-
self.keepalive_config.interval.as_ref()
380+
pub fn get_keepalives_interval(&self) -> Option<Duration> {
381+
self.keepalive_config.interval.as_ref().copied()
382382
}
383383

384384
/// Sets the maximum number of TCP keepalive probes that will be sent before dropping a connection.
@@ -390,8 +390,8 @@ impl Config {
390390
}
391391

392392
/// Gets the maximum number of TCP keepalive probes that will be sent before dropping a connection.
393-
pub fn get_keepalives_retries(&self) -> Option<&u32> {
394-
self.keepalive_config.retries.as_ref()
393+
pub fn get_keepalives_retries(&self) -> Option<u32> {
394+
self.keepalive_config.retries.as_ref().copied()
395395
}
396396

397397
/// Sets the requirements of the session.

0 commit comments

Comments
 (0)