Skip to content

Commit

Permalink
fix(style): use unwrap_or_else when appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
samueltardieu committed Dec 27, 2024
1 parent e89c2e7 commit 50c6c39
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/directed/edmonds_karp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,12 @@ where
let reverse = vertices.iter().collect::<FxIndexSet<_>>();
let mut capacities = EK::new(
vertices.len(),
match reverse.get_index_of(source) {
Some(s) => s,
None => panic!("source not found in vertices"),
},
match reverse.get_index_of(sink) {
Some(s) => s,
None => panic!("sink not found in vertices"),
},
reverse
.get_index_of(source)
.unwrap_or_else(|| panic!("source not found in vertices")),
reverse
.get_index_of(sink)
.unwrap_or_else(|| panic!("sink not found in vertices")),
);
for ((from, to), capacity) in caps {
capacities.set_capacity(
Expand Down

0 comments on commit 50c6c39

Please sign in to comment.