From 90ba703506dcd5df19df20fa7cdb0fd5f27e0fd8 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Wed, 25 Mar 2026 15:55:24 +0300 Subject: [PATCH] colors: drop libc invocations for `var_os` Signed-off-by: NotAShelf Change-Id: I572acd49ef687c8049d43a7ba42bd12c6a6a6964 --- src/colors.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/colors.rs b/src/colors.rs index 7c65944..0fca89e 100644 --- a/src/colors.rs +++ b/src/colors.rs @@ -37,8 +37,8 @@ impl Colors { } pub static COLORS: LazyLock = LazyLock::new(|| { - const NO_COLOR: *const libc::c_char = c"NO_COLOR".as_ptr(); - let is_no_color = unsafe { !libc::getenv(NO_COLOR).is_null() }; + // Only presence matters; value is irrelevant per the NO_COLOR spec + let is_no_color = std::env::var_os("NO_COLOR").is_some(); Colors::new(is_no_color) });