Skip to content

Commit 91de113

Browse files
committed
Convert params from owned to borrowed
1 parent c01f513 commit 91de113

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

sqlx-postgres/src/options/pgpass.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::borrow::Cow;
22
use std::env::var_os;
33
use std::fs::File;
44
use std::io::{BufRead, BufReader};
5-
use std::path::PathBuf;
5+
use std::path::{Path, PathBuf};
66

77
/// try to load a password from the various pgpass file locations
88
pub fn load_password(
@@ -14,7 +14,7 @@ pub fn load_password(
1414
let custom_file = var_os("PGPASSFILE");
1515
if let Some(file) = custom_file {
1616
if let Some(password) =
17-
load_password_from_file(PathBuf::from(file), host, port, username, database)
17+
load_password_from_file(&PathBuf::from(file), host, port, username, database)
1818
{
1919
return Some(password);
2020
}
@@ -30,18 +30,18 @@ pub fn load_password(
3030
.ok()
3131
.map(|basedirs| basedirs.data_dir().join("postgres").join("pgpass.conf"))
3232
};
33-
load_password_from_file(default_file?, host, port, username, database)
33+
load_password_from_file(&default_file?, host, port, username, database)
3434
}
3535

3636
/// try to extract a password from a pgpass file
3737
fn load_password_from_file(
38-
path: PathBuf,
38+
path: &Path,
3939
host: &str,
4040
port: u16,
4141
username: &str,
4242
database: Option<&str>,
4343
) -> Option<String> {
44-
let file = File::open(&path)
44+
let file = File::open(path)
4545
.map_err(|e| {
4646
match e.kind() {
4747
std::io::ErrorKind::NotFound => {

0 commit comments

Comments
 (0)