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.
This commit is contained in:
Ed Page 2024-04-02 12:25:34 -05:00
parent 9eb7c09463
commit 7640081cda

View File

@ -645,6 +645,10 @@ fn resolve_toml(
.map(|mw| field_inherit_with(mw, "badges", || inherit()?.badges()))
.transpose()?;
resolved_toml.badges = resolved_badges.map(manifest::InheritableField::Value);
} else {
for field in original_toml.requires_package() {
bail!("this virtual manifest specifies a `{field}` section, which is not allowed");
}
}
Ok(resolved_toml)
@ -1513,10 +1517,6 @@ fn to_virtual_manifest(
) -> CargoResult<VirtualManifest> {
let root = manifest_file.parent().unwrap();
for field in original_toml.requires_package() {
bail!("this virtual manifest specifies a `{field}` section, which is not allowed");
}
let mut deps = Vec::new();
let (replace, patch) = {
let mut manifest_ctx = ManifestContext {