Skip to content

Commit

Permalink
fmt+clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
erikziyunchi committed Mar 6, 2024
1 parent 38396c5 commit e9da75b
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions crates/water/src/runtime/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ impl H2O<Host> {
}

let engine = Engine::new(&wasm_config)?;

let module = Module::from_file(&engine, &conf.filepath)?;

let linker: Linker<Host> = Linker::new(&engine);

// linker.allow_unknown_exports(true);

let host = Host::default();
let store = Store::new(&engine, host);

Expand Down Expand Up @@ -152,23 +152,19 @@ impl H2O<Host> {
let instance = linker.instantiate(&mut store, &module)?;

// call _start function explicitly if there is one exported from the WATM module
let func = instance
.get_func(&mut store, "_start");

match func {
Some(func) => {
let mut res = vec![Val::null(); func.ty(&store).results().len()];
match func.call(&mut store, &[], &mut res) {
Ok(_) => {}
Err(e) => {
return Err(anyhow::Error::msg(format!(
"failed to call _start function: {}",
e
)))
}
let func = instance.get_func(&mut store, "_start");

if let Some(func) = func {
let mut res = vec![Val::null(); func.ty(&store).results().len()];
match func.call(&mut store, &[], &mut res) {
Ok(_) => {}
Err(e) => {
return Err(anyhow::Error::msg(format!(
"failed to call _start function: {}",
e
)))
}
}
None => {}
}

Ok(H2O {
Expand Down

0 comments on commit e9da75b

Please sign in to comment.