Skip to content

Commit

Permalink
Minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Mar 26, 2022
1 parent ec8882a commit bb4b9d1
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -981,19 +981,15 @@ 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)),
}
.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::<Result<Vec<_>, _>>()?;

if !notices.is_empty() {
Expand Down

0 comments on commit bb4b9d1

Please sign in to comment.