Skip to content

Commit

Permalink
use expect instead of let else
Browse files Browse the repository at this point in the history
  • Loading branch information
tjjfvi committed May 24, 2024
1 parent 552e79b commit 9aca366
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,9 +505,7 @@ impl Book {
}
let mut book = hvm::Book { defs: Vec::new() };
for (fid, name) in &fid_to_name {
let Some(ast_def) = self.defs.get(name) else {
panic!("missing `@main` definition");
};
let ast_def = self.defs.get(name).expect("missing `@main` definition");
let mut def = hvm::Def {
name: name.clone(),
safe: true,
Expand Down
2 changes: 1 addition & 1 deletion tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ expression: rust_output
input_file: tests/programs/empty.hvm
---
exit status: 101
thread 'main' panicked at src/ast.rs:509:9:
thread 'main' panicked at src/ast.rs:508:41:
missing `@main` definition
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

0 comments on commit 9aca366

Please sign in to comment.