Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit016e9a3

Browse files
committed
avoid a silly clone
1 parentb411e5c commit016e9a3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎tokio-postgres/src/connect_raw.rs‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use postgres_protocol::authentication::sasl;
1313
use postgres_protocol::authentication::sasl::ScramSha256;
1414
use postgres_protocol::message::backend::{AuthenticationSaslBody,Message};
1515
use postgres_protocol::message::frontend;
16+
use std::borrow::Cow;
1617
use std::collections::{HashMap,VecDeque};
1718
use std::io;
1819
use std::pin::Pin;
@@ -96,7 +97,10 @@ where
9697
delayed:VecDeque::new(),
9798
};
9899

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);
100104

101105
startup(&mut stream, config,&user).await?;
102106
authenticate(&mut stream, config,&user).await?;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp