mirror of
https://github.com/rust-lang/cargo
synced 2024-08-27 19:29:21 +00:00
refactor(toml): Rely on resolved keywords
This commit is contained in:
parent
d435d0e72a
commit
258d8447a9
|
@ -233,6 +233,10 @@ impl TomlPackage {
|
||||||
})
|
})
|
||||||
.transpose()
|
.transpose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn resolved_keywords(&self) -> Result<Option<&Vec<String>>, UnresolvedError> {
|
||||||
|
self.keywords.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.
|
||||||
|
|
|
@ -590,6 +590,12 @@ pub fn to_real_manifest(
|
||||||
.as_ref(),
|
.as_ref(),
|
||||||
)
|
)
|
||||||
.map(|s| manifest::InheritableField::Value(StringOrBool::String(s)));
|
.map(|s| manifest::InheritableField::Value(StringOrBool::String(s)));
|
||||||
|
package.keywords = package
|
||||||
|
.keywords
|
||||||
|
.clone()
|
||||||
|
.map(|value| field_inherit_with(value, "keywords", || inherit()?.keywords()))
|
||||||
|
.transpose()?
|
||||||
|
.map(manifest::InheritableField::Value);
|
||||||
|
|
||||||
let rust_version = package
|
let rust_version = package
|
||||||
.resolved_rust_version()
|
.resolved_rust_version()
|
||||||
|
@ -927,10 +933,9 @@ pub fn to_real_manifest(
|
||||||
.map(|mw| field_inherit_with(mw, "repository", || inherit()?.repository()))
|
.map(|mw| field_inherit_with(mw, "repository", || inherit()?.repository()))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
keywords: package
|
keywords: package
|
||||||
.keywords
|
.resolved_keywords()
|
||||||
.clone()
|
.expect("previously resolved")
|
||||||
.map(|mw| field_inherit_with(mw, "keywords", || inherit()?.keywords()))
|
.cloned()
|
||||||
.transpose()?
|
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
categories: package
|
categories: package
|
||||||
.categories
|
.categories
|
||||||
|
@ -963,10 +968,6 @@ pub fn to_real_manifest(
|
||||||
.repository
|
.repository
|
||||||
.clone()
|
.clone()
|
||||||
.map(|repository| manifest::InheritableField::Value(repository));
|
.map(|repository| manifest::InheritableField::Value(repository));
|
||||||
package.keywords = package
|
|
||||||
.keywords
|
|
||||||
.as_ref()
|
|
||||||
.map(|_| manifest::InheritableField::Value(metadata.keywords.clone()));
|
|
||||||
package.categories = package
|
package.categories = package
|
||||||
.categories
|
.categories
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
|
Loading…
Reference in a new issue