mirror of
https://github.com/rust-lang/cargo
synced 2024-08-28 03:39:31 +00:00
refactor(toml): Rely on resolved authors
This commit is contained in:
parent
425a8ae478
commit
00ba5780e4
|
@ -207,6 +207,10 @@ impl TomlPackage {
|
|||
self.version.as_ref().map(|v| v.resolved()).transpose()
|
||||
}
|
||||
|
||||
pub fn resolved_authors(&self) -> Result<Option<&Vec<String>>, UnresolvedError> {
|
||||
self.authors.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()
|
||||
}
|
||||
|
|
|
@ -562,6 +562,12 @@ pub fn to_real_manifest(
|
|||
.map(|value| field_inherit_with(value, "version", || inherit()?.version()))
|
||||
.transpose()?
|
||||
.map(manifest::InheritableField::Value);
|
||||
package.authors = package
|
||||
.authors
|
||||
.clone()
|
||||
.map(|value| field_inherit_with(value, "authors", || inherit()?.authors()))
|
||||
.transpose()?
|
||||
.map(manifest::InheritableField::Value);
|
||||
package.description = package
|
||||
.description
|
||||
.clone()
|
||||
|
@ -940,10 +946,9 @@ pub fn to_real_manifest(
|
|||
.expect("previously resolved")
|
||||
.cloned(),
|
||||
authors: package
|
||||
.authors
|
||||
.clone()
|
||||
.map(|mw| field_inherit_with(mw, "authors", || inherit()?.authors()))
|
||||
.transpose()?
|
||||
.resolved_authors()
|
||||
.expect("previously resolved")
|
||||
.cloned()
|
||||
.unwrap_or_default(),
|
||||
license: package
|
||||
.resolved_license()
|
||||
|
@ -976,10 +981,6 @@ pub fn to_real_manifest(
|
|||
links: package.links.clone(),
|
||||
rust_version: rust_version.clone(),
|
||||
};
|
||||
package.authors = package
|
||||
.authors
|
||||
.as_ref()
|
||||
.map(|_| manifest::InheritableField::Value(metadata.authors.clone()));
|
||||
package.exclude = package
|
||||
.exclude
|
||||
.as_ref()
|
||||
|
|
Loading…
Reference in a new issue