diff --git a/CHANGELOG.md b/CHANGELOG.md index d0ebecd..cb4f8f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +### Added + +- Ignores [workspace members](https://doc.rust-lang.org/cargo/reference/workspaces.html) when checking licenses. + ### Changed - Embedded rust-analyzer for expanding procedural macros. diff --git a/src/lib.rs b/src/lib.rs index db02d3e..94341ac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -980,20 +980,18 @@ fn bundle( let notices = libs .iter() - .filter(|(_, (p, _, _, _))| p.has_lib()) - .map(|(_, (p, _, _, _))| p) - .flat_map(|lib_package| { - if let Err(err) = - shell.status("Checking", format!("the license of `{}`", lib_package.id)) - { - return Some(Err(err.into())); - } - match lib_package.read_license_text(mine, cache_dir) { - Ok(Some(license_text)) => Some(Ok((&lib_package.id, license_text))), - Ok(None) => None, - Err(err) => Some(Err(err)), - } + .filter(|(_, (p, _, _, _))| { + p.has_lib() && !metadata.workspace_members.contains(&p.id) + }) + .map(|(_, (lib_package, _, _, _))| { + shell.status("Checking", format!("the license of `{}`", lib_package.id))?; + lib_package + .read_license_text(mine, cache_dir) + .map(|license_text| { + license_text.map(|license_text| (&lib_package.id, license_text)) + }) }) + .flat_map(Result::transpose) .collect::, _>>()?; if !notices.is_empty() {