From c95df353630f86072de4aec676b92d54199a5bbc Mon Sep 17 00:00:00 2001 From: rami3l Date: Sat, 15 Jun 2024 09:35:18 +0800 Subject: [PATCH] refactor(terminalsource): use `.eq_ignore_ascii_case()` in `ColorableTerminal::new` --- src/currentprocess/terminalsource.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/currentprocess/terminalsource.rs b/src/currentprocess/terminalsource.rs index a0092908fc..962e92ca8e 100644 --- a/src/currentprocess/terminalsource.rs +++ b/src/currentprocess/terminalsource.rs @@ -84,12 +84,9 @@ impl ColorableTerminal { /// then color commands will be sent to the stream. /// Otherwise color commands are discarded. pub(super) fn new(stream: StreamSelector) -> Self { - let env_override = process() - .var("RUSTUP_TERM_COLOR") - .map(|it| it.to_lowercase()); - let choice = match env_override.as_deref() { - Ok("always") => ColorChoice::Always, - Ok("never") => ColorChoice::Never, + let choice = match process().var("RUSTUP_TERM_COLOR") { + Ok(s) if s.eq_ignore_ascii_case("always") => ColorChoice::Always, + Ok(s) if s.eq_ignore_ascii_case("never") => ColorChoice::Never, _ if stream.is_a_tty() => ColorChoice::Auto, _ => ColorChoice::Never, };