fix(toml): Simplify [project] warning

This commit is contained in:
Ed Page 2024-04-11 19:29:32 -05:00
parent 8181bc8274
commit 77f96f5c61
2 changed files with 4 additions and 18 deletions

View File

@ -1027,22 +1027,8 @@ fn to_real_manifest(
)));
}
match (&original_toml.package, &original_toml.project) {
(Some(_), Some(_)) => {
warnings.push(format!(
"manifest at `{}` contains both `project` and `package`, \
this could become a hard error in the future",
package_root.display()
));
}
(None, Some(_)) => {
warnings.push(format!(
"manifest at `{}` contains `[project]` instead of `[package]`, \
this could become a hard error in the future",
package_root.display()
));
}
(Some(_), None) | (None, None) => {}
if original_toml.project.is_some() {
warnings.push(format!("`[project]` is deprecated in favor of `[package]`"));
}
if resolved_package.metabuild.is_some() {

View File

@ -1002,7 +1002,7 @@ fn warn_manifest_package_and_project() {
p.cargo("check")
.with_stderr(
"\
[WARNING] manifest at `[CWD]` contains both `project` and `package`, this could become a hard error in the future
[WARNING] `[project]` is deprecated in favor of `[package]`
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",
@ -1083,7 +1083,7 @@ fn warn_manifest_with_project() {
p.cargo("check")
.with_stderr(
"\
[WARNING] manifest at `[CWD]` contains `[project]` instead of `[package]`, this could become a hard error in the future
[WARNING] `[project]` is deprecated in favor of `[package]`
[CHECKING] foo v0.0.1 ([CWD])
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
",