Skip to content

Commit 5e6b808

Browse files
committed
Fix the conversion lifetime by reorganizing the code
1 parent 0558525 commit 5e6b808

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

zng/cmake.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@ pub fn build_zlib_ng(target: &str, compat: bool) {
1717
if target.contains("riscv") {
1818
// Check if we should pass on an explicit boolean value of the WITH_RVV build option.
1919
// See: https://github.com/zlib-ng/zlib-ng?tab=readme-ov-file#advanced-build-options
20-
match env::var_os("RISCV_WITH_RVV")
21-
.and_then(|v| v.to_str())
22-
.map(|s| s.trim().to_uppercase().as_ref())
23-
{
24-
Some("OFF" | "NO" | "FALSE" | "0") => {
25-
// Force RVV off. This turns off RVV entirely, as well as the runtime check for it.
26-
// This is not usually necessary, but can be useful for building binaries portable
27-
// to systems that do not support RVV but where auto-detection fails to identify
28-
// this (as in https://github.com/zlib-ng/zlib-ng/issues/1705).
29-
cmake.define("WITH_RVV", "OFF");
20+
if let Ok(value) = env::var("RISCV_WITH_RVV") {
21+
let value = value.trim().to_uppercase();
22+
match value.as_str() {
23+
"OFF" | "NO" | "FALSE" | "0" => {
24+
// Force RVV off. This turns off RVV entirely, as well as the runtime check for it.
25+
// This is not usually necessary, but can be useful for building binaries portable
26+
// to systems that do not support RVV but where auto-detection fails to identify
27+
// this (as in https://github.com/zlib-ng/zlib-ng/issues/1705).
28+
cmake.define("WITH_RVV", "OFF");
29+
}
30+
"ON" | "YES" | "TRUE" | "1" => {
31+
// Try to use RVV, but still don't do so if a runtime check finds it unavailable.
32+
// This has the same effect as omitting WITH_RVV, unless it has already been set.
33+
cmake.define("WITH_RVV", "ON");
34+
}
35+
_ => {}
3036
}
31-
Some("ON" | "YES" | "TRUE" | "1") => {
32-
// Try to use RVV, but still don't do so if a runtime check finds it unavailable.
33-
// This has the same effect as omitting WITH_RVV, unless it has already been set.
34-
cmake.define("WITH_RVV", "ON");
35-
}
36-
_ => { }
3737
}
3838
}
3939
if target == "i686-pc-windows-msvc" {

0 commit comments

Comments
 (0)