diff --git a/ethers-contract/ethers-contract-abigen/src/util.rs b/ethers-contract/ethers-contract-abigen/src/util.rs index 138f744c..f8858db4 100644 --- a/ethers-contract/ethers-contract-abigen/src/util.rs +++ b/ethers-contract/ethers-contract-abigen/src/util.rs @@ -2,7 +2,6 @@ use ethers_core::types::Address; use std::path::PathBuf; use anyhow::{anyhow, Result}; -use cfg_if::cfg_if; use inflector::Inflector; use proc_macro2::{Ident, Literal, Span, TokenStream}; use quote::quote; @@ -84,12 +83,13 @@ where } /// Perform an HTTP GET request and return the contents of the response. +#[cfg(not(target_arch = "wasm32"))] pub fn http_get(_url: &str) -> Result { - cfg_if! { - if #[cfg(any(target_arch = "wasm32", not(feature = "reqwest")))]{ - Err(anyhow!("HTTP is unsupported")) - } else { + cfg_if::cfg_if! { + if #[cfg(feature = "reqwest")]{ Ok(reqwest::blocking::get(_url)?.text()?) + } else { + Err(anyhow!("HTTP is unsupported")) } } }