Skip to content

Commit

Permalink
format rust
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Nelson committed Nov 30, 2024
1 parent 0849dd7 commit d516cce
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions native/wasmex/src/component_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,22 @@ fn term_to_val(param_term: &Term, param_type: &Type) -> Result<Val, Error> {
Ok(Val::Record(kv))
}
(TermType::Atom, Type::Option(option_type)) => {
let the_atom = param_term.atom_to_string()?;
if the_atom == "nil" {
Ok(Val::Option(None))
} else {
let converted_val = term_to_val(param_term, &option_type.ty())?;
Ok(Val::Option(Some(Box::new(converted_val))))
}
let the_atom = param_term.atom_to_string()?;
if the_atom == "nil" {
Ok(Val::Option(None))
} else {
let converted_val = term_to_val(param_term, &option_type.ty())?;
Ok(Val::Option(Some(Box::new(converted_val))))
}
}
(_term_type, Type::Option(option_type)) => {
let converted_val = term_to_val(param_term, &option_type.ty())?;
Ok(Val::Option(Some(Box::new(converted_val))))
}
(term_type, val_type) => {
Err(rustler::Error::Term(Box::new(format!(
"Could not convert {:?} to {:?}",
term_type, val_type
))))
}
(term_type, val_type) => Err(rustler::Error::Term(Box::new(format!(
"Could not convert {:?} to {:?}",
term_type, val_type
)))),
}
}

Expand Down

0 comments on commit d516cce

Please sign in to comment.