address review feedback

This commit is contained in:
Pietro Albini 2022-11-24 17:25:35 +01:00
parent f78e6468ba
commit f8a7123b27
No known key found for this signature in database
GPG key ID: CD76B35F7734769E
3 changed files with 11 additions and 6 deletions

View file

@ -255,11 +255,14 @@ changelog-seen = 2
# Defaults to the Python interpreter used to execute x.py
#python = "python"
# The path to the REUSE executable to use. REUSE will be used to gather
# the licensing information of the codebase.
# The path to the REUSE executable to use. Note that REUSE is not required in
# most cases, as our tooling relies on a cached (and shrinked) copy of the
# REUSE output present in the git repository and in our source tarballs.
#
# If this is omitted, the cached licensing information present in the source
# tarball will have to be present.
# REUSE is only needed if your changes caused the overral licensing of the
# repository to change, and the cached copy has to be regenerated.
#
# Defaults to the "reuse" command in the system path.
#reuse = "reuse"
# Force Cargo to check that Cargo.lock describes the precise dependency

View file

@ -22,7 +22,7 @@ fn main() -> Result<(), Error> {
std::fs::write(
&dest,
&serde_json::to_vec_pretty(&serde_json::json!({
"files": crate::path_tree::strip_interning(tree, &interner),
"files": crate::path_tree::expand_interned_licenses(tree, &interner),
}))?,
)?;

View file

@ -270,7 +270,9 @@ pub(crate) fn build(mut input: Vec<(PathBuf, LicenseId)>) -> Node<LicenseId> {
Node::Root { childs }
}
pub(crate) fn strip_interning(
/// Convert a `Node<LicenseId>` into a `Node<&License>`, expanding all interned license IDs with a
/// reference to the actual license metadata.
pub(crate) fn expand_interned_licenses(
node: Node<LicenseId>,
interner: &LicensesInterner,
) -> Node<&License> {