cargo icon indicating copy to clipboard operation
cargo copied to clipboard

Cargo will silently ignore invalid .cargo/config options

Open expenses opened this issue 7 years ago • 2 comments

For example, cargo will silently ignore

rustflags = [...]

where it should be under a build subheading like:

[build]
rustflags = [...]

This is related to #4377, so perhaps it could be done at the same time?

expenses avatar Aug 14 '18 05:08 expenses

Cargo configuration is considered as a kind of environment for Cargo. That said, usually a CLI won't complain to the existence of unrecognized environment variables. However, Cargo could possibly do a bit better — collect unrecognized configs and put a warning there

13 cargo configuration values cannot be recognized.
Run `cargo config get --unrecognized` to reveal.

This does need more discussions and designs. Maybe use --verbose or cargo report instead of unstable cargo config, though starting as an unstable flag is more likely to be accepted.

weihanglo avatar May 14 '23 16:05 weihanglo

A linter or cargo config would be a good home for something like this. See also #12235

epage avatar Oct 23 '23 21:10 epage