From 11e90049d2d465d062acfb53926db7ee94f19e55 Mon Sep 17 00:00:00 2001 From: Jamey Sharp Date: Sun, 25 Sep 2022 20:39:26 -0700 Subject: [PATCH] Fix wasmtime-bench-api build (#4956) This fixes a compile-time error introduced in #4207. The `?` operator doesn't work inside `Option::map` because it tries to return from the inner closure, not the outer function. Apparently our CI doesn't build wasmtime-bench-api so it didn't catch this issue. --- crates/bench-api/src/lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/bench-api/src/lib.rs b/crates/bench-api/src/lib.rs index 82a53dda24..a946fdb6b5 100644 --- a/crates/bench-api/src/lib.rs +++ b/crates/bench-api/src/lib.rs @@ -430,9 +430,11 @@ impl BenchState { execution_end: extern "C" fn(*mut u8), make_wasi_cx: impl FnMut() -> Result + 'static, ) -> Result { - let config = options - .map(|o| o.config(Some(&Triple::host().to_string()))?) - .unwrap_or(Config::new()); + let config = if let Some(o) = &options { + o.config(Some(&Triple::host().to_string()))? + } else { + Config::new() + }; // NB: do not configure a code cache. let engine = Engine::new(&config)?; let mut linker = Linker::::new(&engine);