Skip to content

Commit

Permalink
fix: use expect() instead of unwrap()
Browse files Browse the repository at this point in the history
  • Loading branch information
alexvitkov committed Aug 25, 2023
1 parent 69085ed commit 0972151
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/noirc_frontend/src/hir/resolution/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ impl<'a> Resolver<'a> {
let args = vecmap(args, |arg| self.resolve_type_inner(arg, new_variables));
let ret = Box::new(self.resolve_type_inner(*ret, new_variables));

// unwrap() here is valid, because the only places we don't have a span are omitted types
// expect() here is valid, because the only places we don't have a span are omitted types
// e.g. a function without return type implicitly has a spanless UnresolvedType::Unit return type
// To get an invalid env type, the user must explicitly specify the type, which will have a span
let env_span = env.span.unwrap();
let env_span = env.span.expect("Invalid closure environment type");

let env = Box::new(self.resolve_type_inner(*env, new_variables));

Expand Down

0 comments on commit 0972151

Please sign in to comment.