From aaeb4849fc2903cdc9cdbdc4100ff037a81728d9 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Mon, 30 Mar 2026 16:56:37 +0900 Subject: [PATCH] stdbuf: remove clippy::unnecessary_wraps --- src/uu/stdbuf/src/stdbuf.rs | 28 ++++++++-------------------- 1 file changed, 8 insertions(+), 20 deletions(-) diff --git a/src/uu/stdbuf/src/stdbuf.rs b/src/uu/stdbuf/src/stdbuf.rs index 6355fea09..60a7206a6 100644 --- a/src/uu/stdbuf/src/stdbuf.rs +++ b/src/uu/stdbuf/src/stdbuf.rs @@ -80,30 +80,18 @@ enum ProgramOptionsError { } #[cfg(all(unix, not(target_vendor = "apple"), not(target_os = "cygwin")))] -#[expect( - clippy::unnecessary_wraps, - reason = "fn sig must match on all platforms" -)] -fn preload_strings() -> UResult<(&'static str, &'static str)> { - Ok(("LD_PRELOAD", "so")) +fn preload_strings() -> (&'static str, &'static str) { + ("LD_PRELOAD", "so") } #[cfg(target_vendor = "apple")] -#[expect( - clippy::unnecessary_wraps, - reason = "fn sig must match on all platforms" -)] -fn preload_strings() -> UResult<(&'static str, &'static str)> { - Ok(("DYLD_LIBRARY_PATH", "dylib")) +fn preload_strings() -> (&'static str, &'static str) { + ("DYLD_LIBRARY_PATH", "dylib") } #[cfg(target_os = "cygwin")] -#[expect( - clippy::unnecessary_wraps, - reason = "fn sig must match on all platforms" -)] -fn preload_strings() -> UResult<(&'static str, &'static str)> { - Ok(("LD_PRELOAD", "dll")) +fn preload_strings() -> (&'static str, &'static str) { + ("LD_PRELOAD", "dll") } fn check_option(matches: &ArgMatches, name: &str) -> Result { @@ -146,7 +134,7 @@ fn get_preload_env(tmp_dir: &TempDir) -> UResult<(String, PathBuf)> { use std::fs::File; use std::io::Write; - let (preload, extension) = preload_strings()?; + let (preload, extension) = preload_strings(); let inject_path = tmp_dir.path().join("libstdbuf").with_extension(extension); let mut file = File::create(&inject_path)?; @@ -157,7 +145,7 @@ fn get_preload_env(tmp_dir: &TempDir) -> UResult<(String, PathBuf)> { #[cfg(feature = "feat_external_libstdbuf")] fn get_preload_env(_tmp_dir: &TempDir) -> UResult<(String, PathBuf)> { - let (preload, extension) = preload_strings()?; + let (preload, extension) = preload_strings(); // Use the directory provided at compile time via LIBSTDBUF_DIR environment variable // This will fail to compile if LIBSTDBUF_DIR is not set, which is the desired behavior