Skip to content
This repository was archived by the owner on Sep 9, 2025. It is now read-only.

Commit d594cd2

Browse files
author
Hendrik van Antwerpen
committed
Replace unwrap with expect
1 parent 4631eee commit d594cd2

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

stack-graphs/src/cycles.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,22 +208,22 @@ impl<A: Appendable + Clone> AppendingCycleDetector<A> {
208208
while let Some(appendage) = prefix_appendages.pop_front(appendables) {
209209
prefix_path
210210
.resolve_to(graph, partials, appendage.start_node(ctx))
211-
.unwrap();
211+
.expect("resolving cycle prefix path failed");
212212
appendage
213213
.append_to(graph, partials, ctx, &mut prefix_path)
214-
.unwrap();
214+
.expect("appending cycle prefix path failed");
215215
}
216216

217217
// build cyclic path
218218
let cyclic_path = maybe_cyclic_path
219219
.unwrap_or_else(|| PartialPath::from_node(graph, partials, end_node));
220220
prefix_path
221221
.resolve_to(graph, partials, cyclic_path.start_node)
222-
.unwrap();
222+
.expect("resolving cyclic path failed");
223223
prefix_path.ensure_no_overlapping_variables(partials, &cyclic_path);
224224
prefix_path
225225
.concatenate(graph, partials, &cyclic_path)
226-
.unwrap();
226+
.expect("concatenating cyclic path failed ");
227227
if !prefix_path.is_productive(graph, partials) {
228228
return Err(PathResolutionError::DisallowedCycle);
229229
}

stack-graphs/src/partial.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2555,12 +2555,16 @@ impl Node {
25552555
}
25562556
Node::JumpTo(_) => {}
25572557
Node::PopScopedSymbol(node) => {
2558-
let symbol = symbol_stack.pop_front(partials).unwrap();
2558+
let symbol = symbol_stack
2559+
.pop_front(partials)
2560+
.expect("missing symbol for pop scoped symbol node in precondition");
25592561
debug_assert_eq!(symbol.symbol, node.symbol);
25602562
*scope_stack = symbol.scopes.into_option().unwrap();
25612563
}
25622564
Node::PopSymbol(node) => {
2563-
let symbol = symbol_stack.pop_front(partials).unwrap();
2565+
let symbol = symbol_stack
2566+
.pop_front(partials)
2567+
.expect("missing symbol for pop symbol node in precondition");
25642568
debug_assert_eq!(symbol.symbol, node.symbol);
25652569
}
25662570
Node::PushScopedSymbol(_) => {}
@@ -2603,11 +2607,15 @@ impl Node {
26032607
Self::PopScopedSymbol(_) => {}
26042608
Self::PopSymbol(_) => {}
26052609
Self::PushScopedSymbol(node) => {
2606-
let symbol = symbol_stack.pop_front(partials).unwrap();
2610+
let symbol = symbol_stack
2611+
.pop_front(partials)
2612+
.expect("missing symbol for push scoped symbol node in postcondition");
26072613
debug_assert_eq!(symbol.symbol, node.symbol);
26082614
}
26092615
Self::PushSymbol(node) => {
2610-
let symbol = symbol_stack.pop_front(partials).unwrap();
2616+
let symbol = symbol_stack
2617+
.pop_front(partials)
2618+
.expect("missing symbol for push symbol node in postcondition");
26112619
debug_assert_eq!(symbol.symbol, node.symbol);
26122620
}
26132621
Self::Root(_) => {}

0 commit comments

Comments
 (0)