Skip to content

Commit

Permalink
Tweak string conversion
Browse files Browse the repository at this point in the history
For correctness and MSRV compatibility.
  • Loading branch information
EliahKagan committed Sep 22, 2024
1 parent 66df3f5 commit a1b2d3d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions zng/cmake.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::env;
use std::ffi::OsStr;

pub fn build_zlib_ng(target: &str, compat: bool) {
let mut cmake = cmake::Config::new("src/zlib-ng");
Expand All @@ -19,10 +18,8 @@ pub fn build_zlib_ng(target: &str, compat: bool) {
// Check if we should pass on an explicit boolean value of the WITH_RVV build option.
// See: https://github.com/zlib-ng/zlib-ng?tab=readme-ov-file#advanced-build-options
match env::var_os("RISCV_WITH_RVV")
.map(OsStr::to_str)
.map(str::trim)
.map(str::to_uppercase)
.map(Into::into)
.and_then(|v| v.to_str())
.map(|s| s.trim().to_uppercase().as_ref())
{
Some("OFF" | "NO" | "FALSE" | "0") => {
// Force RVV off. This turns off RVV entirely, as well as the runtime check for it.
Expand Down

0 comments on commit a1b2d3d

Please sign in to comment.