Skip to content

Commit 368f133

Browse files
committed
refactor(terminalsource): use .eq_ignore_ascii_case() in ColorableTerminal::new
1 parent 988f14a commit 368f133

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/currentprocess/terminalsource.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,9 @@ impl ColorableTerminal {
8484
/// then color commands will be sent to the stream.
8585
/// Otherwise color commands are discarded.
8686
pub(super) fn new(stream: StreamSelector) -> Self {
87-
let env_override = process()
88-
.var("RUSTUP_TERM_COLOR")
89-
.map(|it| it.to_lowercase());
90-
let choice = match env_override.as_deref() {
91-
Ok("always") => ColorChoice::Always,
92-
Ok("never") => ColorChoice::Never,
87+
let choice = match process().var("RUSTUP_TERM_COLOR") {
88+
Ok(s) if s.eq_ignore_ascii_case("always") => ColorChoice::Always,
89+
Ok(s) if s.eq_ignore_ascii_case("never") => ColorChoice::Never,
9390
_ if stream.is_a_tty() => ColorChoice::Auto,
9491
_ => ColorChoice::Never,
9592
};

0 commit comments

Comments
 (0)