Skip to content

Commit c056461

Browse files
committed
Use std home_dir instead of home crate
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 61c67be commit c056461

File tree

4 files changed

+3
-5
lines changed

4 files changed

+3
-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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ mod shlex;
33
pub mod windows;
44

55
pub use shlex::{escape_posix_for_single_quotes, shlex_posix, shlex_windows};
6+
use std::env::home_dir;
67

78
use std::path::{Path, PathBuf};
89
use uv_fs::Simplified;
@@ -145,7 +146,7 @@ impl Shell {
145146
///
146147
/// See: <https://github.com/rust-lang/rustup/blob/fede22fea7b160868cece632bd213e6d72f8912f/src/cli/self_update/shell.rs#L197>
147148
pub fn configuration_files(self) -> Vec<PathBuf> {
148-
let Some(home_dir) = home::home_dir() else {
149+
let Some(home_dir) = home_dir() else {
149150
return vec![];
150151
};
151152
match self {
@@ -232,7 +233,7 @@ impl Shell {
232233

233234
/// Returns `true` if the given path is on the `PATH` in this shell.
234235
pub fn contains_path(path: &Path) -> bool {
235-
let home_dir = home::home_dir();
236+
let home_dir = home_dir();
236237
std::env::var_os(EnvVars::PATH)
237238
.as_ref()
238239
.iter()

0 commit comments

Comments
 (0)