mirror of
https://github.com/rust-lang/cargo
synced 2024-08-28 03:39:31 +00:00
refactor(toml): Rely on resolved license
This commit is contained in:
parent
047c1fe9d0
commit
b942be5bc1
|
@ -241,6 +241,10 @@ impl TomlPackage {
|
||||||
pub fn resolved_categories(&self) -> Result<Option<&Vec<String>>, UnresolvedError> {
|
pub fn resolved_categories(&self) -> Result<Option<&Vec<String>>, UnresolvedError> {
|
||||||
self.categories.as_ref().map(|v| v.resolved()).transpose()
|
self.categories.as_ref().map(|v| v.resolved()).transpose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn resolved_license(&self) -> Result<Option<&String>, UnresolvedError> {
|
||||||
|
self.license.as_ref().map(|v| v.resolved()).transpose()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An enum that allows for inheriting keys from a workspace in a Cargo.toml.
|
/// An enum that allows for inheriting keys from a workspace in a Cargo.toml.
|
||||||
|
|
|
@ -602,6 +602,12 @@ pub fn to_real_manifest(
|
||||||
.map(|value| field_inherit_with(value, "categories", || inherit()?.categories()))
|
.map(|value| field_inherit_with(value, "categories", || inherit()?.categories()))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.map(manifest::InheritableField::Value);
|
.map(manifest::InheritableField::Value);
|
||||||
|
package.license = package
|
||||||
|
.license
|
||||||
|
.clone()
|
||||||
|
.map(|value| field_inherit_with(value, "license", || inherit()?.license()))
|
||||||
|
.transpose()?
|
||||||
|
.map(manifest::InheritableField::Value);
|
||||||
|
|
||||||
let rust_version = package
|
let rust_version = package
|
||||||
.resolved_rust_version()
|
.resolved_rust_version()
|
||||||
|
@ -924,10 +930,9 @@ pub fn to_real_manifest(
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
license: package
|
license: package
|
||||||
.license
|
.resolved_license()
|
||||||
.clone()
|
.expect("previously resolved")
|
||||||
.map(|mw| field_inherit_with(mw, "license", || inherit()?.license()))
|
.cloned(),
|
||||||
.transpose()?,
|
|
||||||
license_file: package
|
license_file: package
|
||||||
.license_file
|
.license_file
|
||||||
.clone()
|
.clone()
|
||||||
|
@ -961,10 +966,6 @@ pub fn to_real_manifest(
|
||||||
.authors
|
.authors
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|_| manifest::InheritableField::Value(metadata.authors.clone()));
|
.map(|_| manifest::InheritableField::Value(metadata.authors.clone()));
|
||||||
package.license = metadata
|
|
||||||
.license
|
|
||||||
.clone()
|
|
||||||
.map(|license| manifest::InheritableField::Value(license));
|
|
||||||
package.license_file = metadata
|
package.license_file = metadata
|
||||||
.license_file
|
.license_file
|
||||||
.clone()
|
.clone()
|
||||||
|
|
Loading…
Reference in a new issue