Skip to content

Commit

Permalink
refactor(terminalsource): use .eq_ignore_ascii_case() in `Colorable…
Browse files Browse the repository at this point in the history
…Terminal::new`
  • Loading branch information
rami3l committed Jun 15, 2024
1 parent 988f14a commit 368f133
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/currentprocess/terminalsource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down

0 comments on commit 368f133

Please sign in to comment.