Skip to content

Commit

Permalink
chore: make clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
ctron committed Jan 21, 2025
1 parent e0c5ba7 commit cd155b7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
3 changes: 1 addition & 2 deletions modules/analysis/src/endpoints/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ async fn test_simple_dep_endpoint(ctx: &TrustifyContext) -> Result<(), anyhow::E
let purls = response["items"][0]["deps"]
.as_array()
.iter()
.map(|deps| *deps)
.flatten()
.flat_map(|deps| *deps)
.flat_map(|dep| dep["purl"].as_array())
.flatten()
.flat_map(|purl| purl.as_str().map(|s| s.to_string()))
Expand Down
21 changes: 9 additions & 12 deletions modules/analysis/src/service/load.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub async fn get_nodes<C: ConnectionTrait>(
let stmt =
Statement::from_sql_and_values(DatabaseBackend::Postgres, sql, [distinct_sbom_id.into()]);

Ok(Node::find_by_statement(stmt).all(connection).await?)
Node::find_by_statement(stmt).all(connection).await
}

#[instrument(skip(connection))]
Expand Down Expand Up @@ -268,22 +268,19 @@ impl AnalysisService {
log::debug!("Adding edge {:?}", edge);

// insert edge into the graph
match (
if let (Some(left), Some(right)) = (
nodes.get(&edge.left_node_id),
nodes.get(&edge.right_node_id),
) {
(Some(left), Some(right)) => {
if edge.relationship == Relationship::DescribedBy {
describedby_node_id.push(*left);
}
if edge.relationship == Relationship::DescribedBy {
describedby_node_id.push(*left);
}

// remove all node IDs we somehow connected
detected_nodes.remove(&edge.left_node_id);
detected_nodes.remove(&edge.right_node_id);
// remove all node IDs we somehow connected
detected_nodes.remove(&edge.left_node_id);
detected_nodes.remove(&edge.right_node_id);

g.add_edge(*left, *right, edge.relationship);
}
_ => {}
g.add_edge(*left, *right, edge.relationship);
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/analysis/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ where
.map(|item| {
item.ancestors
.iter()
.map(|anc| OwnedNode::from(anc))
.map(OwnedNode::from)
.sorted_by_key(|n| n.id.to_string())
.collect::<Vec<_>>()
})
Expand Down

0 comments on commit cd155b7

Please sign in to comment.