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
+9 -7
View File
@@ -318,10 +318,12 @@ where
G::Vertex: Debug,
G::Edge: Debug,
{
let path = path_option.expect(&format!(
"path should exist between source vertex {:?} and connected targets {:?}",
source, targets
));
let path = path_option.unwrap_or_else(|| {
panic!(
"path should exist between source vertex {:?} and connected targets {:?}",
source, targets
)
});
if targets.contains(&source) {
assert!(
@@ -402,9 +404,9 @@ pub fn assert_isomorphic<G: GraphTopology, H: GraphTopology>(
.position(|x| {
vertex_map(x.vertex) == incidence.vertex && edge_map(x.edge) == incidence.edge
})
.expect(&format!(
"unexpected incidence {incidence:?} of vertex {v:?} in the other graph"
));
.unwrap_or_else(|| {
panic!("unexpected incidence {incidence:?} of vertex {v:?} in the other graph")
});
expected.swap_remove(pos);
}
assert!(