Skip to content

Commit c5ad97d

Browse files
committed
Use IsTerminal in rustc_errors
1 parent 8be3ce9 commit c5ad97d

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3452,7 +3452,6 @@ name = "rustc_errors"
34523452
version = "0.0.0"
34533453
dependencies = [
34543454
"annotate-snippets",
3455-
"atty",
34563455
"rustc_ast",
34573456
"rustc_ast_pretty",
34583457
"rustc_data_structures",

compiler/rustc_errors/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ rustc_target = { path = "../rustc_target" }
1818
rustc_hir = { path = "../rustc_hir" }
1919
rustc_lint_defs = { path = "../rustc_lint_defs" }
2020
unicode-width = "0.1.4"
21-
atty = "0.2"
2221
termcolor = "1.0"
2322
annotate-snippets = "0.9"
2423
termize = "0.1.1"

compiler/rustc_errors/src/emitter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use rustc_error_messages::FluentArgs;
2828
use rustc_span::hygiene::{ExpnKind, MacroKind};
2929
use std::borrow::Cow;
3030
use std::cmp::{max, min, Reverse};
31-
use std::io;
3231
use std::io::prelude::*;
32+
use std::io::{self, IsTerminal};
3333
use std::iter;
3434
use std::path::Path;
3535
use termcolor::{Ansi, BufferWriter, ColorChoice, ColorSpec, StandardStream};
@@ -619,14 +619,14 @@ impl ColorConfig {
619619
fn to_color_choice(self) -> ColorChoice {
620620
match self {
621621
ColorConfig::Always => {
622-
if atty::is(atty::Stream::Stderr) {
622+
if io::stderr().is_terminal() {
623623
ColorChoice::Always
624624
} else {
625625
ColorChoice::AlwaysAnsi
626626
}
627627
}
628628
ColorConfig::Never => ColorChoice::Never,
629-
ColorConfig::Auto if atty::is(atty::Stream::Stderr) => ColorChoice::Auto,
629+
ColorConfig::Auto if io::stderr().is_terminal() => ColorChoice::Auto,
630630
ColorConfig::Auto => ColorChoice::Never,
631631
}
632632
}

compiler/rustc_errors/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
66
#![feature(drain_filter)]
77
#![feature(if_let_guard)]
8+
#![feature(is_terminal)]
89
#![feature(adt_const_params)]
910
#![feature(let_chains)]
1011
#![feature(never_type)]

0 commit comments

Comments
 (0)