Skip to content

Commit de96aa1

Browse files
authored
Use std home_dir instead of home crate (#16483)
The `home_dir` function in std was deprecated for some years for reading `HOME` on Windows. It has recently been fixed and undeprecated: rust-lang/rust#132515 Conversely, the Cargo maintainers want us to move away from the home crate (https://github.com/rust-lang/cargo/tree/master/crates/home): > Note: This has been fixed in Rust 1.85 to no longer use the HOME environment variable on Windows. If you are still using this crate for the purpose of getting a home directory, you are strongly encouraged to switch to using the standard library's home_dir instead. It is planned to have the deprecation notice removed in 1.87. > > This crate further provides two functions, cargo_home and rustup_home, which are the canonical way to determine the location that Cargo and rustup store their data. > > See rust-lang/rust#43321. > > > This crate is maintained by the Cargo team, primarily for use by Cargo and Rustup and not intended for external use. This crate may make major changes to its APIs or be deprecated without warning. When lunacookies/etcetera#36 merges, we can remove the home crate from our dependency tree.
1 parent db1d34e commit de96aa1

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ goblin = { version = "0.10.0", default-features = false, features = ["std", "elf
121121
h2 = { version = "0.4.7" }
122122
hashbrown = { version = "0.16.0" }
123123
hex = { version = "0.4.3" }
124-
home = { version = "0.5.9" }
125124
html-escape = { version = "0.2.13" }
126125
http = { version = "1.1.0" }
127126
indexmap = { version = "2.5.0" }

crates/uv-shell/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ uv-static = { workspace = true }
2222

2323
anyhow = { workspace = true }
2424
fs-err = { workspace = true }
25-
home = { workspace = true }
2625
same-file = { workspace = true }
2726
tracing = { workspace = true }
2827

crates/uv-shell/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ pub mod windows;
44

55
pub use shlex::{escape_posix_for_single_quotes, shlex_posix, shlex_windows};
66

7+
use std::env::home_dir;
78
use std::path::{Path, PathBuf};
9+
810
use uv_fs::Simplified;
911
use uv_static::EnvVars;
1012

@@ -145,7 +147,7 @@ impl Shell {
145147
///
146148
/// See: <https://github.com/rust-lang/rustup/blob/fede22fea7b160868cece632bd213e6d72f8912f/src/cli/self_update/shell.rs#L197>
147149
pub fn configuration_files(self) -> Vec<PathBuf> {
148-
let Some(home_dir) = home::home_dir() else {
150+
let Some(home_dir) = home_dir() else {
149151
return vec![];
150152
};
151153
match self {
@@ -232,7 +234,7 @@ impl Shell {
232234

233235
/// Returns `true` if the given path is on the `PATH` in this shell.
234236
pub fn contains_path(path: &Path) -> bool {
235-
let home_dir = home::home_dir();
237+
let home_dir = home_dir();
236238
std::env::var_os(EnvVars::PATH)
237239
.as_ref()
238240
.iter()

0 commit comments

Comments
 (0)