Skip to content

Commit cf69e01

Browse files
authored
refactor: simplify removeconstignore verify (#768)
leftover review comment: #757 (comment)
1 parent b019fa3 commit cf69e01

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/hugr/rewrite/consts.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ impl Rewrite for RemoveConstIgnore {
4545
if (!h.contains_node(node)) || (!h.get_optype(node).is_load_constant()) {
4646
return Err(RemoveError::InvalidNode(node));
4747
}
48-
49-
if h.out_value_types(node)
50-
.next()
51-
.is_some_and(|(p, _)| h.linked_inputs(node, p).next().is_some())
52-
{
48+
let (p, _) = h
49+
.out_value_types(node)
50+
.exactly_one()
51+
.ok()
52+
.expect("LoadConstant has only one output.");
53+
if h.linked_inputs(node, p).next().is_some() {
5354
return Err(RemoveError::ValueUsed(node));
5455
}
5556

0 commit comments

Comments
 (0)