We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentb411e5c commit016e9a3Copy full SHA for 016e9a3
tokio-postgres/src/connect_raw.rs
@@ -13,6 +13,7 @@ use postgres_protocol::authentication::sasl;
13
use postgres_protocol::authentication::sasl::ScramSha256;
14
use postgres_protocol::message::backend::{AuthenticationSaslBody,Message};
15
use postgres_protocol::message::frontend;
16
+use std::borrow::Cow;
17
use std::collections::{HashMap,VecDeque};
18
use std::io;
19
use std::pin::Pin;
@@ -96,7 +97,10 @@ where
96
97
delayed:VecDeque::new(),
98
};
99
-let user = config.user.clone().unwrap_or_else(whoami::username);
100
+let user = config
101
+.user
102
+.as_deref()
103
+.map_or_else(||Cow::Owned(whoami::username()),Cow::Borrowed);
104
105
startup(&mut stream, config,&user).await?;
106
authenticate(&mut stream, config,&user).await?;