From 91eb7cb823c825702d26491b31ede8c8eb08551b Mon Sep 17 00:00:00 2001 From: Marco Allegretti Date: Thu, 12 Mar 2026 12:52:55 +0100 Subject: [PATCH] fix: gate host_fetch and host_notify on wasmtime-runtime feature; suppress dead_code on resolve_weft_system_url --- crates/weft-app-shell/src/embedder.rs | 1 + crates/weft-runtime/src/main.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/weft-app-shell/src/embedder.rs b/crates/weft-app-shell/src/embedder.rs index 519c98b..5621a5c 100644 --- a/crates/weft-app-shell/src/embedder.rs +++ b/crates/weft-app-shell/src/embedder.rs @@ -340,6 +340,7 @@ fn load_ui_kit_script() -> Option { std::fs::read_to_string(ui_kit_path()).ok() } +#[allow(dead_code)] fn resolve_weft_system_url(url: &ServoUrl) -> Option { if url.scheme() != "weft-system" { return None; } let host = url.host_str().unwrap_or(""); diff --git a/crates/weft-runtime/src/main.rs b/crates/weft-runtime/src/main.rs index 201f8c3..85b0c74 100644 --- a/crates/weft-runtime/src/main.rs +++ b/crates/weft-runtime/src/main.rs @@ -309,7 +309,7 @@ fn run_module( .map_err(|()| anyhow::anyhow!("wasm component run exited with error")) } -#[cfg(feature = "net-fetch")] +#[cfg(all(feature = "wasmtime-runtime", feature = "net-fetch"))] fn host_fetch( url: &str, method: &str, @@ -336,7 +336,7 @@ fn host_fetch( Ok((status, content_type, body_bytes)) } -#[cfg(not(feature = "net-fetch"))] +#[cfg(all(feature = "wasmtime-runtime", not(feature = "net-fetch")))] fn host_fetch( _url: &str, _method: &str, @@ -346,6 +346,7 @@ fn host_fetch( Err("net-fetch capability not compiled in".to_owned()) } +#[cfg(feature = "wasmtime-runtime")] fn host_notify(title: &str, body: &str, icon: Option<&str>) -> Result<(), String> { let mut cmd = std::process::Command::new("notify-send"); if let Some(i) = icon {