Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: Replace unwrap with ok_or where possible #824

Merged
merged 1 commit into from
May 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions bindings/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,9 @@ impl Instance {
name: &str,
args: &[TypedValue],
) -> Result<TypedExecutionResult, Error> {
let func_idx = self.find_exported_function_index(name);
if func_idx.is_none() {
return Err(Error::FunctionNotFound);
}
let func_idx = func_idx.unwrap();
let func_idx = self
.find_exported_function_index(name)
.ok_or(Error::FunctionNotFound)?;

let func_type = unsafe { self.get_function_type(func_idx) };
if func_type.inputs_size != args.len() {
Expand Down