Flatten nests
@@ -100,7 +100,8 @@ def _list_dependencies_by_crate(path: pathlib.Path, *, basedir: pathlib.Path, ca
stdout=PIPE,
).stdout.decode())['unused_deps'].values()
for unused_dep in unused_deps:
- if unused_dep['manifest_path'] == package['manifest_path']:
+ if unused_dep['manifest_path'] != package['manifest_path']:
+ continue
for name_in_toml in [*unused_dep['normal'], *unused_dep['development'], *unused_dep['build']]:
if name_in_toml in renames:
unused_packages.add(normal_build_node_deps[name_in_toml])
@@ -110,7 +111,8 @@ def _list_dependencies_by_crate(path: pathlib.Path, *, basedir: pathlib.Path, ca
unused_packages.add(package_id)
for package_id in normal_build_node_deps.values():
- if package_id not in unused_packages:
+ if package_id in unused_packages:
+ continue
package = packages_by_id[package_id]
related_source_files = _related_source_files(_cargo_metadata(pathlib.Path(package["manifest_path"]).parent))
for target in package['targets']:
