Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Aug 8, 2024
1 parent 75e7320 commit 5705445
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/cargo-link2/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,18 @@ fn find_root_manifest_path(md: &Metadata) -> Result<PathBuf> {
fn find_used_crates(md: &Metadata, link_candidates: &[PatchPkg]) -> Result<Vec<PatchPkg>> {
let mut used_crates = HashSet::new();

let workspace_packages = md
.packages
.iter()
.filter(|p| md.workspace_members.contains(&p.id))
.map(|p| p.name.clone())
.collect::<HashSet<_>>();

for pkg in &md.packages {
if !workspace_packages.contains(&pkg.name) {
continue;
}

for dep in &pkg.dependencies {
if let Some(linked) = link_candidates.iter().find(|c| c.name == dep.name) {
used_crates.insert(linked.clone());
Expand Down

0 comments on commit 5705445

Please sign in to comment.