Skip to content

Commit 77f96f5

Browse files
committed
fix(toml): Simplify [project] warning
1 parent 8181bc8 commit 77f96f5

File tree

2 files changed

+4
-18
lines changed

2 files changed

+4
-18
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,22 +1027,8 @@ fn to_real_manifest(
10271027
)));
10281028
}
10291029

1030-
match (&original_toml.package, &original_toml.project) {
1031-
(Some(_), Some(_)) => {
1032-
warnings.push(format!(
1033-
"manifest at `{}` contains both `project` and `package`, \
1034-
this could become a hard error in the future",
1035-
package_root.display()
1036-
));
1037-
}
1038-
(None, Some(_)) => {
1039-
warnings.push(format!(
1040-
"manifest at `{}` contains `[project]` instead of `[package]`, \
1041-
this could become a hard error in the future",
1042-
package_root.display()
1043-
));
1044-
}
1045-
(Some(_), None) | (None, None) => {}
1030+
if original_toml.project.is_some() {
1031+
warnings.push(format!("`[project]` is deprecated in favor of `[package]`"));
10461032
}
10471033

10481034
if resolved_package.metabuild.is_some() {

tests/testsuite/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ fn warn_manifest_package_and_project() {
10021002
p.cargo("check")
10031003
.with_stderr(
10041004
"\
1005-
[WARNING] manifest at `[CWD]` contains both `project` and `package`, this could become a hard error in the future
1005+
[WARNING] `[project]` is deprecated in favor of `[package]`
10061006
[CHECKING] foo v0.0.1 ([CWD])
10071007
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
10081008
",
@@ -1083,7 +1083,7 @@ fn warn_manifest_with_project() {
10831083
p.cargo("check")
10841084
.with_stderr(
10851085
"\
1086-
[WARNING] manifest at `[CWD]` contains `[project]` instead of `[package]`, this could become a hard error in the future
1086+
[WARNING] `[project]` is deprecated in favor of `[package]`
10871087
[CHECKING] foo v0.0.1 ([CWD])
10881088
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
10891089
",

0 commit comments

Comments
 (0)