Skip to content

Commit

Permalink
Use match for isize Err
Browse files Browse the repository at this point in the history
  • Loading branch information
enavarro51 committed Nov 25, 2023
1 parent 5d387b1 commit b41cf8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion rustworkx-core/src/generators/random_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ where
}
}
} else {
let num_nodes: isize = num_nodes.try_into().map_err(|_| InvalidInputError).unwrap();
let num_nodes: isize = match num_nodes.try_into() {
Ok(nodes) => nodes,
Err(_) => return Err(InvalidInputError {}),
};
let lp: f64 = (1.0 - probability).ln();
let between = Uniform::new(0.0, 1.0);

Expand Down

0 comments on commit b41cf8a

Please sign in to comment.