From f12549cf23ef79510c1b0cb16b0b617f2af6df59 Mon Sep 17 00:00:00 2001 From: Bailey Hayes Date: Wed, 18 Feb 2026 16:27:45 -0500 Subject: [PATCH] fix(postgres): remove home crate in favor of std::env::home_dir `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 --- Cargo.lock | 1 - sqlx-postgres/Cargo.toml | 1 - sqlx-postgres/src/options/pgpass.rs | 4 +++- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe01e11720..236039f0ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3954,7 +3954,6 @@ dependencies = [ "hex", "hkdf", "hmac", - "home", "ipnet", "ipnetwork", "itoa", diff --git a/sqlx-postgres/Cargo.toml b/sqlx-postgres/Cargo.toml index 1ab7c713ad..2943049f0b 100644 --- a/sqlx-postgres/Cargo.toml +++ b/sqlx-postgres/Cargo.toml @@ -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 } diff --git a/sqlx-postgres/src/options/pgpass.rs b/sqlx-postgres/src/options/pgpass.rs index 930c5f0f51..ca904fc751 100644 --- a/sqlx-postgres/src/options/pgpass.rs +++ b/sqlx-postgres/src/options/pgpass.rs @@ -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;