From adc88dba139cf9d43d1588fbaf95dd8981da58d7 Mon Sep 17 00:00:00 2001 From: Arsenii Kulikov Date: Mon, 19 Aug 2024 03:39:01 +0800 Subject: [PATCH] cfg --- crates/compilers/src/compilers/multi.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/compilers/src/compilers/multi.rs b/crates/compilers/src/compilers/multi.rs index 832cdf62..de0a1481 100644 --- a/crates/compilers/src/compilers/multi.rs +++ b/crates/compilers/src/compilers/multi.rs @@ -40,10 +40,11 @@ impl Default for MultiCompiler { fn default() -> Self { let vyper = Vyper::new("vyper").ok(); - #[cfg(feature = "svm-solc")] - let solc = Some(SolcCompiler::AutoDetect); - #[cfg(not(feature = "svm-solc"))] - let solc = crate::solc::Solc::new("solc").map(SolcCompiler::Specific).ok(); + let solc = if cfg!(feature = "svm-solc") { + Some(SolcCompiler::AutoDetect) + } else { + crate::solc::Solc::new("solc").map(SolcCompiler::Specific).ok() + }; Self { solc, vyper } }