Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Use `if cfg!(...)` instead of `#[cfg]` (#12889)

Alex Crichtonf33f15e64c32
diff --git a/cranelift/codegen/build.rs b/cranelift/codegen/build.rs
index cbd2731df0..82b4e7a8e4 100644
--- a/cranelift/codegen/build.rs
+++ b/cranelift/codegen/build.rs
@@ -223,8 +223,10 @@ fn run_compilation(compilation: &IsleCompilation) -> Result<(), Errors> {
// threshold, because we cannot rely on rustc doing regalloc
// on all of the local bindings to shrink the stack frame to a
// reasonable size.
- #[cfg(not(debug_assertions))]
- {
+ if cfg!(debug_assertions) {
+ options.split_match_arms = true;
+ options.match_arm_split_threshold = Some(4);
+ } else {
options.split_match_arms = std::env::var("CARGO_FEATURE_ISLE_SPLIT_MATCH").is_ok();
if let Ok(value) = std::env::var("ISLE_SPLIT_MATCH_THRESHOLD") {
options.match_arm_split_threshold = Some(value.parse().unwrap_or_else(|err| {
@@ -232,11 +234,6 @@ fn run_compilation(compilation: &IsleCompilation) -> Result<(), Errors> {
}));
}
}
- #[cfg(debug_assertions)]
- {
- options.split_match_arms = true;
- options.match_arm_split_threshold = Some(4);
- }
if let Ok(out_dir) = std::env::var("OUT_DIR") {
options.prefixes.push(isle::codegen::Prefix {