Skip to content

Commit 50c6c39

Browse files
committed
fix(style): use unwrap_or_else when appropriate
1 parent e89c2e7 commit 50c6c39

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/directed/edmonds_karp.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,12 @@ where
6262
let reverse = vertices.iter().collect::<FxIndexSet<_>>();
6363
let mut capacities = EK::new(
6464
vertices.len(),
65-
match reverse.get_index_of(source) {
66-
Some(s) => s,
67-
None => panic!("source not found in vertices"),
68-
},
69-
match reverse.get_index_of(sink) {
70-
Some(s) => s,
71-
None => panic!("sink not found in vertices"),
72-
},
65+
reverse
66+
.get_index_of(source)
67+
.unwrap_or_else(|| panic!("source not found in vertices")),
68+
reverse
69+
.get_index_of(sink)
70+
.unwrap_or_else(|| panic!("sink not found in vertices")),
7371
);
7472
for ((from, to), capacity) in caps {
7573
capacities.set_capacity(

0 commit comments

Comments
 (0)