Skip to content

Commit 7640081

Browse files
committed
Group logic for fields dependent on package
I'm somewhat tempted to flatten the function call. The parallel between the package an virtual-manifest cases would help to keep them in sync.
1 parent 9eb7c09 commit 7640081

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,10 @@ fn resolve_toml(
645645
.map(|mw| field_inherit_with(mw, "badges", || inherit()?.badges()))
646646
.transpose()?;
647647
resolved_toml.badges = resolved_badges.map(manifest::InheritableField::Value);
648+
} else {
649+
for field in original_toml.requires_package() {
650+
bail!("this virtual manifest specifies a `{field}` section, which is not allowed");
651+
}
648652
}
649653

650654
Ok(resolved_toml)
@@ -1513,10 +1517,6 @@ fn to_virtual_manifest(
15131517
) -> CargoResult<VirtualManifest> {
15141518
let root = manifest_file.parent().unwrap();
15151519

1516-
for field in original_toml.requires_package() {
1517-
bail!("this virtual manifest specifies a `{field}` section, which is not allowed");
1518-
}
1519-
15201520
let mut deps = Vec::new();
15211521
let (replace, patch) = {
15221522
let mut manifest_ctx = ManifestContext {

0 commit comments

Comments
 (0)