Remove function calls inside of 'expect'

This commit is contained in:
2026-10-12 21:52:51 +02:00
parent b124e58b38
commit 7cfee9cce5
3 changed files with 69 additions and 50 deletions
+18 -12
View File
@@ -452,10 +452,12 @@ fn assert_vertex_incidences<G: GraphTopology>(
let pos = expected
.iter()
.position(|x| *x == incidence)
.expect(&format!(
"unexpected incidence {incidence:?} of vertex {:?} from iterator after delete",
v
));
.unwrap_or_else(|| {
panic!(
"unexpected incidence {incidence:?} of vertex {:?} from iterator after delete",
v
)
});
expected.swap_remove(pos);
}
assert!(
@@ -479,10 +481,12 @@ fn assert_vertex_incidence_cursor<G: GraphTopology>(
let pos = expected
.iter()
.position(|x| *x == incidence)
.expect(&format!(
"unexpected incidence {incidence:?} of vertex {:?} from cursor after delete",
v
));
.unwrap_or_else(|| {
panic!(
"unexpected incidence {incidence:?} of vertex {:?} from cursor after delete",
v
)
});
expected.swap_remove(pos);
}
assert!(
@@ -508,10 +512,12 @@ fn assert_incident_edges_after_delete<G: GraphTopology>(
v
);
for e in graph.incident_edges(v) {
let pos = expected.iter().position(|f| *f == e).expect(&format!(
"unexpected incident edge {e:?} of vertex {:?} after delete",
v
));
let pos = expected.iter().position(|f| *f == e).unwrap_or_else(|| {
panic!(
"unexpected incident edge {e:?} of vertex {:?} after delete",
v
)
});
expected.swap_remove(pos);
}
assert!(