Skip to content

Commit

Permalink
Simplify getting package indicies for target dependencies
Browse files Browse the repository at this point in the history
This commit addresses #3827 (comment)
  • Loading branch information
ysaito1001 committed Sep 16, 2024
1 parent dc2c231 commit fd7c438
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions tools/ci-build/sdk-lockfiles/src/audit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,12 @@ fn new_dependency(lockfile: &Lockfile, target: &str) -> bool {
target
);
let tree = lockfile.dependency_tree().unwrap();
let indices: Vec<_> = [target.to_owned()]
let package = lockfile
.packages
.iter()
.map(|dep| {
let package = lockfile
.packages
.iter()
.find(|pkg| pkg.name.as_str() == dep)
.unwrap();
tree.nodes()[&package.into()]
})
.collect();
.find(|pkg| pkg.name.as_str() == target)
.expect("{target} must be in dependencies listed in `lockfile`");
let indices = vec![tree.nodes()[&package.into()]];

for index in &indices {
let mut visited: BTreeSet<NodeIndex> = BTreeSet::new();
Expand Down

0 comments on commit fd7c438

Please sign in to comment.