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): Error on [project] in Edition 2024 #13747

Merged
merged 10 commits into from
Apr 16, 2024
Prev Previous commit
Next Next commit
fix(toml): Simplify [project] warning
epage committed Apr 15, 2024
commit 77f96f5c6111661da87b48c58b321f0b7d7bf8c3
18 changes: 2 additions & 16 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
@@ -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() {
4 changes: 2 additions & 2 deletions tests/testsuite/check.rs
Original file line number Diff line number Diff line change
@@ -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 [..]
",