mirror of
https://github.com/rust-lang/cargo
synced 2024-08-27 19:29:21 +00:00
refactor(toml): Rely on resolved publish
This commit is contained in:
parent
20302b34b7
commit
2ea1ac6fac
|
@ -219,6 +219,10 @@ impl TomlPackage {
|
|||
self.include.as_ref().map(|v| v.resolved()).transpose()
|
||||
}
|
||||
|
||||
pub fn resolved_publish(&self) -> Result<Option<&VecStringOrBool>, UnresolvedError> {
|
||||
self.publish.as_ref().map(|v| v.resolved()).transpose()
|
||||
}
|
||||
|
||||
pub fn resolved_description(&self) -> Result<Option<&String>, UnresolvedError> {
|
||||
self.description.as_ref().map(|v| v.resolved()).transpose()
|
||||
}
|
||||
|
|
|
@ -580,6 +580,12 @@ pub fn to_real_manifest(
|
|||
.map(|value| field_inherit_with(value, "include", || inherit()?.include()))
|
||||
.transpose()?
|
||||
.map(manifest::InheritableField::Value);
|
||||
package.publish = package
|
||||
.publish
|
||||
.clone()
|
||||
.map(|value| field_inherit_with(value, "publish", || inherit()?.publish()))
|
||||
.transpose()?
|
||||
.map(manifest::InheritableField::Value);
|
||||
package.description = package
|
||||
.description
|
||||
.clone()
|
||||
|
@ -986,17 +992,8 @@ pub fn to_real_manifest(
|
|||
validate_profiles(profiles, cli_unstable, &features, warnings)?;
|
||||
}
|
||||
|
||||
let publish = package
|
||||
.publish
|
||||
.clone()
|
||||
.map(|publish| field_inherit_with(publish, "publish", || inherit()?.publish()).unwrap());
|
||||
|
||||
package.publish = publish
|
||||
.clone()
|
||||
.map(|p| manifest::InheritableField::Value(p));
|
||||
|
||||
let version = package.resolved_version().expect("previously resolved");
|
||||
let publish = match publish {
|
||||
let publish = match package.resolved_publish().expect("previously resolved") {
|
||||
Some(manifest::VecStringOrBool::VecString(ref vecstring)) => Some(vecstring.clone()),
|
||||
Some(manifest::VecStringOrBool::Bool(false)) => Some(vec![]),
|
||||
Some(manifest::VecStringOrBool::Bool(true)) => None,
|
||||
|
|
Loading…
Reference in a new issue