Skip to content

Commit 49deefe

Browse files
committed
refactor(test): Reuse 'cargo_home' in more cases
1 parent b0e515a commit 49deefe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/cargo-test-support/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ pub trait TestEnvCommandExt: Sized {
13081308
self = self
13091309
.current_dir(&paths::root())
13101310
.env("HOME", paths::home())
1311-
.env("CARGO_HOME", paths::home().join(".cargo"))
1311+
.env("CARGO_HOME", paths::cargo_home())
13121312
.env("__CARGO_TEST_ROOT", paths::global_root())
13131313
// Force Cargo to think it's on the stable channel for all tests, this
13141314
// should hopefully not surprise us as we add cargo features over time and

crates/cargo-test-support/src/registry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl RegistryBuilder {
279279
/// Initializes the registry.
280280
#[must_use]
281281
pub fn build(self) -> TestRegistry {
282-
let config_path = paths::home().join(".cargo/config.toml");
282+
let config_path = paths::cargo_home().join("config.toml");
283283
t!(fs::create_dir_all(config_path.parent().unwrap()));
284284
let prefix = if let Some(alternative) = &self.alternative {
285285
format!("{alternative}-")
@@ -391,7 +391,7 @@ impl RegistryBuilder {
391391
}
392392

393393
if self.configure_token {
394-
let credentials = paths::home().join(".cargo/credentials.toml");
394+
let credentials = paths::cargo_home().join("credentials.toml");
395395
match &registry.token {
396396
Token::Plaintext(token) => {
397397
if let Some(alternative) = &self.alternative {
@@ -1195,7 +1195,7 @@ impl Package {
11951195
/// Creates a new package builder.
11961196
/// Call `publish()` to finalize and build the package.
11971197
pub fn new(name: &str, vers: &str) -> Package {
1198-
let config = paths::home().join(".cargo/config.toml");
1198+
let config = paths::cargo_home().join("config.toml");
11991199
if !config.exists() {
12001200
init();
12011201
}

0 commit comments

Comments
 (0)