diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 3ba6b0166..1d2829c3d 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -228,8 +228,16 @@ impl Interface for Rust { self.app_settings.target_triple.clone(), ); - let mut s = self.app_settings.target_triple.split('-'); - let (arch, _, host) = (s.next().unwrap(), s.next().unwrap(), s.next().unwrap()); + let target_triple = &self.app_settings.target_triple; + let target_components: Vec<&str> = target_triple.split('-').collect(); + let (arch, host) = match target_components.as_slice() { + [arch, _, host] => (*arch, *host), + _ => { + log::warn!("Invalid target triple: {}", target_triple); + return env; + } + }; + env.insert( "TAURI_ENV_ARCH", match arch {