From a1b2d3d8db8c9a30a288680cf411913074f7f140 Mon Sep 17 00:00:00 2001 From: Eliah Kagan Date: Sun, 22 Sep 2024 07:54:17 -0400 Subject: [PATCH] Tweak string conversion For correctness and MSRV compatibility. --- zng/cmake.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zng/cmake.rs b/zng/cmake.rs index 6bfc949..9f3b757 100644 --- a/zng/cmake.rs +++ b/zng/cmake.rs @@ -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"); @@ -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.