Skip to content

Commit

Permalink
fix: Avoid warning config twice
Browse files Browse the repository at this point in the history
  • Loading branch information
linyihai committed Sep 23, 2024
1 parent 4da73ee commit 8b8ff13
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/cargo/util/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1590,10 +1590,14 @@ impl GlobalContext {
}
}

// Need to check the `$CARGO_HOME/config` have been warned already.
let home_config_without_extention = home.join("config");
let already_warned = stash.contains(&home_config_without_extention);

// Once we're done, also be sure to walk the home directory even if it's not
// in our history to be sure we pick up that standard location for
// information.
if let Some(path) = self.get_file_path(home, "config", true)? {
if let Some(path) = self.get_file_path(home, "config", !already_warned)? {
if !stash.contains(&path) {
walk(&path)?;
}
Expand Down
2 changes: 0 additions & 2 deletions tests/testsuite/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,6 @@ f1 = 1
.with_stderr_data(str![[r#"
[WARNING] `[ROOT]/.cargo/config` is deprecated in favor of `config.toml`
[NOTE] if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
[WARNING] `[ROOT]/.cargo/config` is deprecated in favor of `config.toml`
[NOTE] if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
"#]])
.run();
Expand Down

0 comments on commit 8b8ff13

Please sign in to comment.