Skip to content

Commit 208d10d

Browse files
committed
fix(toml): Switch the duplicate table warning to an unused key warning
1 parent a4a3254 commit 208d10d

File tree

2 files changed

+19
-37
lines changed

2 files changed

+19
-37
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2340,8 +2340,7 @@ fn deprecated_underscore<T>(
23402340
if old.is_some() && new.is_some() {
23412341
let old_path = new_path.replace("-", "_");
23422342
warnings.push(format!(
2343-
"conflicting between `{new_path}` and `{old_path}` in the `{name}` {kind}.\n
2344-
`{old_path}` is ignored and not recommended for use in the future"
2343+
"unused manifest key `{old_path}` in the `{name}` {kind}"
23452344
))
23462345
}
23472346
}

tests/testsuite/bad_config.rs

Lines changed: 18 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -836,9 +836,7 @@ fn dev_dependencies2_conflict() {
836836
p.cargo("check")
837837
.with_stderr_contains(
838838
"\
839-
[WARNING] conflicting between `dev-dependencies` and `dev_dependencies` in the `foo` package.
840-
841-
`dev_dependencies` is ignored and not recommended for use in the future
839+
[WARNING] unused manifest key `dev_dependencies` in the `foo` package
842840
",
843841
)
844842
.run();
@@ -876,9 +874,7 @@ fn build_dependencies2_conflict() {
876874
p.cargo("check")
877875
.with_stderr_contains(
878876
"\
879-
[WARNING] conflicting between `build-dependencies` and `build_dependencies` in the `foo` package.
880-
881-
`build_dependencies` is ignored and not recommended for use in the future
877+
[WARNING] unused manifest key `build_dependencies` in the `foo` package
882878
",
883879
)
884880
.run();
@@ -907,9 +903,7 @@ fn lib_crate_type2_conflict() {
907903
p.cargo("check")
908904
.with_stderr_contains(
909905
"\
910-
[WARNING] conflicting between `crate-type` and `crate_type` in the `foo` library target.
911-
912-
`crate_type` is ignored and not recommended for use in the future
906+
[WARNING] unused manifest key `crate_type` in the `foo` library target
913907
",
914908
)
915909
.run();
@@ -956,12 +950,9 @@ fn examples_crate_type2_conflict() {
956950
p.cargo("check")
957951
.with_stderr_contains(
958952
"\
959-
[WARNING] conflicting between `crate-type` and `crate_type` in the `ex` example target.
960-
961-
`crate_type` is ignored and not recommended for use in the future
962-
[WARNING] conflicting between `crate-type` and `crate_type` in the `goodbye` example target.
963-
964-
`crate_type` is ignored and not recommended for use in the future",
953+
[WARNING] unused manifest key `crate_type` in the `ex` example target
954+
[WARNING] unused manifest key `crate_type` in the `goodbye` example target
955+
",
965956
)
966957
.run();
967958
}
@@ -999,13 +990,11 @@ fn cargo_platform_build_dependencies2_conflict() {
999990
.build();
1000991

1001992
p.cargo("check")
1002-
.with_stderr_contains(
1003-
format!("\
1004-
[WARNING] conflicting between `build-dependencies` and `build_dependencies` in the `{host}` platform target.
1005-
1006-
`build_dependencies` is ignored and not recommended for use in the future
1007-
")
1008-
)
993+
.with_stderr_contains(format!(
994+
"\
995+
[WARNING] unused manifest key `build_dependencies` in the `{host}` platform target
996+
"
997+
))
1009998
.run();
1010999
}
10111000

@@ -1041,13 +1030,11 @@ fn cargo_platform_dev_dependencies2_conflict() {
10411030
.build();
10421031

10431032
p.cargo("check")
1044-
.with_stderr_contains(
1045-
format!("\
1046-
[WARNING] conflicting between `dev-dependencies` and `dev_dependencies` in the `{host}` platform target.
1047-
1048-
`dev_dependencies` is ignored and not recommended for use in the future
1049-
")
1050-
)
1033+
.with_stderr_contains(format!(
1034+
"\
1035+
[WARNING] unused manifest key `dev_dependencies` in the `{host}` platform target
1036+
"
1037+
))
10511038
.run();
10521039
}
10531040

@@ -1088,9 +1075,7 @@ fn default_features2_conflict() {
10881075
p.cargo("check")
10891076
.with_stderr_contains(
10901077
"\
1091-
[WARNING] conflicting between `default-features` and `default_features` in the `a` dependency.
1092-
1093-
`default_features` is ignored and not recommended for use in the future
1078+
[WARNING] unused manifest key `default_features` in the `a` dependency
10941079
",
10951080
)
10961081
.run();
@@ -1117,9 +1102,7 @@ fn proc_macro2_conflict() {
11171102
foo.cargo("check")
11181103
.with_stderr_contains(
11191104
"\
1120-
[WARNING] conflicting between `proc-macro` and `proc_macro` in the `foo` library target.
1121-
1122-
`proc_macro` is ignored and not recommended for use in the future
1105+
[WARNING] unused manifest key `proc_macro` in the `foo` library target
11231106
",
11241107
)
11251108
.run();

0 commit comments

Comments
 (0)