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

fix(toml): Be more forceful with underscore/dash redundancy #13798

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2340,7 +2340,7 @@ fn deprecated_underscore<T>(
if old.is_some() && new.is_some() {
let old_path = new_path.replace("-", "_");
warnings.push(format!(
"unused manifest key `{old_path}` in the `{name}` {kind}"
"`{old_path}` is redundant with `{new_path}`, preferring `{new_path}` in the `{name}` {kind}"
))
} else if old.is_some() {
let old_path = new_path.replace("-", "_");
Expand Down
18 changes: 9 additions & 9 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ fn dev_dependencies2_conflict() {
p.cargo("check")
.with_stderr_contains(
"\
[WARNING] unused manifest key `dev_dependencies` in the `foo` package
[WARNING] `dev_dependencies` is redundant with `dev-dependencies`, preferring `dev-dependencies` in the `foo` package
",
)
.run();
Expand Down Expand Up @@ -948,7 +948,7 @@ fn build_dependencies2_conflict() {
p.cargo("check")
.with_stderr_contains(
"\
[WARNING] unused manifest key `build_dependencies` in the `foo` package
[WARNING] `build_dependencies` is redundant with `build-dependencies`, preferring `build-dependencies` in the `foo` package
",
)
.run();
Expand Down Expand Up @@ -1006,7 +1006,7 @@ fn lib_crate_type2_conflict() {
p.cargo("check")
.with_stderr_contains(
"\
[WARNING] unused manifest key `crate_type` in the `foo` library target
[WARNING] `crate_type` is redundant with `crate-type`, preferring `crate-type` in the `foo` library target
",
)
.run();
Expand Down Expand Up @@ -1101,8 +1101,8 @@ fn examples_crate_type2_conflict() {
p.cargo("check")
.with_stderr_contains(
"\
[WARNING] unused manifest key `crate_type` in the `ex` example target
[WARNING] unused manifest key `crate_type` in the `goodbye` example target
[WARNING] `crate_type` is redundant with `crate-type`, preferring `crate-type` in the `ex` example target
[WARNING] `crate_type` is redundant with `crate-type`, preferring `crate-type` in the `goodbye` example target
",
)
.run();
Expand Down Expand Up @@ -1183,7 +1183,7 @@ fn cargo_platform_build_dependencies2_conflict() {
p.cargo("check")
.with_stderr_contains(format!(
"\
[WARNING] unused manifest key `build_dependencies` in the `{host}` platform target
[WARNING] `build_dependencies` is redundant with `build-dependencies`, preferring `build-dependencies` in the `{host}` platform target
"
))
.run();
Expand Down Expand Up @@ -1262,7 +1262,7 @@ fn cargo_platform_dev_dependencies2_conflict() {
p.cargo("check")
.with_stderr_contains(format!(
"\
[WARNING] unused manifest key `dev_dependencies` in the `{host}` platform target
[WARNING] `dev_dependencies` is redundant with `dev-dependencies`, preferring `dev-dependencies` in the `{host}` platform target
"
))
.run();
Expand Down Expand Up @@ -1349,7 +1349,7 @@ fn default_features2_conflict() {
p.cargo("check")
.with_stderr_contains(
"\
[WARNING] unused manifest key `default_features` in the `a` dependency
[WARNING] `default_features` is redundant with `default-features`, preferring `default-features` in the `a` dependency
",
)
.run();
Expand Down Expand Up @@ -1403,7 +1403,7 @@ fn proc_macro2_conflict() {
foo.cargo("check")
.with_stderr_contains(
"\
[WARNING] unused manifest key `proc_macro` in the `foo` library target
[WARNING] `proc_macro` is redundant with `proc-macro`, preferring `proc-macro` in the `foo` library target
",
)
.run();
Expand Down