@@ -2,7 +2,7 @@ use std::borrow::Cow;
22use std:: env:: var_os;
33use std:: fs:: File ;
44use 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
88pub 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
3737fn 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