fix(postgres): remove home crate in favor of std::env::home_dir (#4171)

`home_dir()` was fixed in Rust 1.85 (rust-lang/rust#132515) and
un-deprecated in 1.87 (rust-lang/rust#137327). Since our MSRV is 1.86, the function is correct but still carries a deprecation warning until MSRV is bumped to 1.87.

This will allow other targets to compile including WebAssembly, see https://github.com/rust-lang/cargo/issues/12297
This commit is contained in:
Bailey Hayes 2026-02-27 17:15:47 -05:00 committed by GitHub
parent d9b3340d2f
commit 0a9eac1876
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

1
Cargo.lock generated
View File

@ -3954,7 +3954,6 @@ dependencies = [
"hex",
"hkdf",
"hmac",
"home",
"ipnet",
"ipnetwork",
"itoa",

View File

@ -57,7 +57,6 @@ base64 = { version = "0.22.0", default-features = false, features = ["std"] }
bitflags = { version = "2", default-features = false }
byteorder = { version = "1.4.3", default-features = false, features = ["std"] }
hex = "0.4.3"
home = "0.5.5"
itoa = "1.0.1"
log = "0.4.18"
memchr = { version = "2.4.1", default-features = false }

View File

@ -21,7 +21,9 @@ pub fn load_password(
}
#[cfg(not(target_os = "windows"))]
let default_file = home::home_dir().map(|path| path.join(".pgpass"));
// home_dir fixed in 1.85 (rust-lang/rust#132515) and un-deprecated in 1.87 (rust-lang/rust#137327)
#[allow(deprecated)]
let default_file = std::env::home_dir().map(|path| path.join(".pgpass"));
#[cfg(target_os = "windows")]
let default_file = {
use etcetera::BaseStrategy;