Skip to content

Commit e3d44dd

Browse files
committed
Use IsTerminal in librustdoc
1 parent d60ba29 commit e3d44dd

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -4272,7 +4272,6 @@ version = "0.0.0"
42724272
dependencies = [
42734273
"arrayvec",
42744274
"askama",
4275-
"atty",
42764275
"expect-test",
42774276
"itertools",
42784277
"minifier",

src/librustdoc/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ path = "lib.rs"
99
[dependencies]
1010
arrayvec = { version = "0.7", default-features = false }
1111
askama = { version = "0.11", default-features = false, features = ["config"] }
12-
atty = "0.2"
1312
itertools = "0.10.1"
1413
minifier = "0.2.2"
1514
once_cell = "1.10.0"

src/librustdoc/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#![feature(box_patterns)]
99
#![feature(control_flow_enum)]
1010
#![feature(drain_filter)]
11+
#![feature(is_terminal)]
1112
#![feature(let_chains)]
1213
#![feature(test)]
1314
#![feature(never_type)]
@@ -69,7 +70,7 @@ extern crate jemalloc_sys;
6970

7071
use std::default::Default;
7172
use std::env::{self, VarError};
72-
use std::io;
73+
use std::io::{self, IsTerminal};
7374
use std::process;
7475

7576
use rustc_driver::abort_on_err;
@@ -180,7 +181,7 @@ fn init_logging() {
180181
let color_logs = match std::env::var("RUSTDOC_LOG_COLOR").as_deref() {
181182
Ok("always") => true,
182183
Ok("never") => false,
183-
Ok("auto") | Err(VarError::NotPresent) => atty::is(atty::Stream::Stdout),
184+
Ok("auto") | Err(VarError::NotPresent) => io::stdout().is_terminal(),
184185
Ok(value) => early_error(
185186
ErrorOutputType::default(),
186187
&format!("invalid log color value '{}': expected one of always, never, or auto", value),

0 commit comments

Comments
 (0)