Skip to content

Commit

Permalink
chore: cleanup. [no ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvxa committed May 9, 2024
1 parent 2caea99 commit 840eb52
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/oxc_linter/src/rules/react/rules_of_hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ impl Rule for RulesOfHooks {
}

// TODO: all `dijkstra` algorithms can be merged together for better performance.
let dijkstra = petgraph::algo::dijkstra(graph, func_cfg_ix, Some(node_cfg_ix), |_| 0);

// Is this node cyclic?
if petgraph::algo::dijkstra(graph, node_cfg_ix, None, |_| 0)
Expand All @@ -175,7 +174,7 @@ impl Rule for RulesOfHooks {
}

// All nodes should be reachable from our hook, Otherwise we have a conditional/branching flow.
if dijkstra
if petgraph::algo::dijkstra(graph, func_cfg_ix, Some(node_cfg_ix), |_| 0)
.into_iter()
.any(|(f, _)| !petgraph::algo::has_path_connecting(graph, f, node_cfg_ix, None))
{
Expand Down

0 comments on commit 840eb52

Please sign in to comment.