refactor(toml): Rely on resolved authors

This commit is contained in:
Ed Page 2024-03-19 14:32:41 -05:00
parent 425a8ae478
commit 00ba5780e4
2 changed files with 13 additions and 8 deletions

View File

@ -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()
}

View File

@ -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()