Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsetting configuration values in deeper configuration files should be possible #10057

Closed
gspr opened this issue Nov 7, 2021 · 1 comment
Closed
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@gspr
Copy link

gspr commented Nov 7, 2021

Problem

The Cargo configuration documentation states:

If a key is specified in multiple config files, the values will get merged together. Numbers, strings, and booleans will use the value in the deeper config directory taking precedence over ancestor directories, where the home directory is the lowest priority. Arrays will be joined together.

This seems to lead to it being impossible to use deeper configuration directories to un-set values for keys that have been set in ancestors, which seems counter to the documented idea that deeper levels should take presedence.

For example, if ~/.cargo/config.toml has

[source.crates-io]
replace-with = "foo"

then ~/some-project/.cargo/config.toml cannot disable source replacement for the crates-io source. It could very well change the replace-with key's value string to something else than "foo", but that doesn't actually disable source replacement. For that, the key would have to be unset.

Proposed Solution

If it is indeed desired that deeper configuration files should take presedence (something that seems reasonable), then it should also be possible to unset/undefine keys defined by ancestors. Otherwise this presedence is only partial.

Notes

No response

@gspr gspr added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Nov 7, 2021
@ehuss
Copy link
Contributor

ehuss commented Dec 6, 2021

I believe this is a duplicate of #8687 and #8112, so closing in favor of those.

@ehuss ehuss closed this as completed Dec 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants