Repository: EmbarkStudios/cargo-about (language: rust)

Issue:
Crates with publish=false may be added even when private crates are ignored
**Describe the bug**
When you have a workspace with several `publish = false` crates that depend on each other using path dependencies, the private crates may be added to the list of licenses even if you enable `private = { ignore = true }`.

**To Reproduce**

Steps to reproduce the behavior:
1. Download example project and extract: [cargo-about-issue.tar.gz](https://github.com/EmbarkStudios/cargo-about/files/8112732/cargo-about-issue.tar.gz)
    ```
    tar xzf cargo-about-issue.tar.gz
    ```
2. `cd cargo-about-issue`
3. `cargo about generate about.hbs | grep abc`

**Expected behavior**
Should not match any lines because the `abc` crate is `publish = false`.

**Actual behavior**
The `abc` crate is included in the output with the `MIT` license, even though it has no license specified.

**Device:**
 - OS: Linux
 - Version: cargo-about 0.4.7

**Additional context**
Add any other context about the problem here.



Discussion / hints:

Fix patch:
diff --git a/src/cargo-about/generate.rs b/src/cargo-about/generate.rs
index 591bf47..886b3b4 100644
--- a/src/cargo-about/generate.rs
+++ b/src/cargo-about/generate.rs
@@ -256,7 +256,7 @@ struct Input<'a> {
 
 fn generate(
     nfos: &[licenses::KrateLicense<'_>],
-    resolved: &[licenses::Resolved],
+    resolved: &[Option<licenses::Resolved>],
     files: &licenses::resolution::Files,
     stream: term::termcolor::StandardStream,
     hbs: &Handlebars<'_>,
@@ -270,7 +270,11 @@ fn generate(
 
     let licenses = {
         let mut licenses = BTreeMap::new();
-        for (krate_license, resolved) in nfos.iter().zip(resolved.iter()) {
+        for (krate_license, resolved) in nfos
+            .iter()
+            .zip(resolved.iter())
+            .filter_map(|(kl, res)| res.as_ref().map(|res| (kl, res)))
+        {
             if !resolved.diagnostics.is_empty() {
                 let mut streaml = stream.lock();
 
diff --git a/src/licenses/resolution.rs b/src/licenses/resolution.rs
index f6d4e24..7060567 100644
--- a/src/licenses/resolution.rs
+++ b/src/licenses/resolution.rs
@@ -56,6 +56,7 @@ impl<'acc> fmt::Display for Accepted<'acc> {
     }
 }
 
+#[derive(Debug)]
 pub struct Resolved {
     /// The minimum license requirements that are required
     pub licenses: Vec<LicenseReq>,
@@ -100,12 +101,12 @@ pub fn resolve(
     licenses: &[KrateLicense<'_>],
     accepted: &[Licensee],
     krate_cfg: &std::collections::BTreeMap<String, config::KrateConfig>,
-) -> (Files, Vec<Resolved>) {
+) -> (Files, Vec<Option<Resolved>>) {
     let mut files = codespan::Files::new();
 
     let resolved = licenses
         .iter()
-        .filter_map(|kl| {
+        .map(|kl| {
             let mut resolved = Resolved {
                 licenses: Vec::new(),
                 diagnostics: Vec::new(),


Test patch: