Skip to content

Commit 8b8ff13

Browse files
committed
fix: Avoid warning config twice
1 parent 4da73ee commit 8b8ff13

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/cargo/util/context/mod.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1590,10 +1590,14 @@ impl GlobalContext {
15901590
}
15911591
}
15921592

1593+
// Need to check the `$CARGO_HOME/config` have been warned already.
1594+
let home_config_without_extention = home.join("config");
1595+
let already_warned = stash.contains(&home_config_without_extention);
1596+
15931597
// Once we're done, also be sure to walk the home directory even if it's not
15941598
// in our history to be sure we pick up that standard location for
15951599
// information.
1596-
if let Some(path) = self.get_file_path(home, "config", true)? {
1600+
if let Some(path) = self.get_file_path(home, "config", !already_warned)? {
15971601
if !stash.contains(&path) {
15981602
walk(&path)?;
15991603
}

tests/testsuite/config.rs

-2
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,6 @@ f1 = 1
315315
.with_stderr_data(str![[r#"
316316
[WARNING] `[ROOT]/.cargo/config` is deprecated in favor of `config.toml`
317317
[NOTE] if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
318-
[WARNING] `[ROOT]/.cargo/config` is deprecated in favor of `config.toml`
319-
[NOTE] if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
320318
321319
"#]])
322320
.run();

0 commit comments

Comments
 (0)