From e3d44dd4bdd901d284ec47a29e0bb7d825f9786b Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Sun, 16 Oct 2022 14:56:03 +0100 Subject: [PATCH] Use IsTerminal in librustdoc --- Cargo.lock | 1 - src/librustdoc/Cargo.toml | 1 - src/librustdoc/lib.rs | 5 +++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bf5ff830acc..6630b6479dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4272,7 +4272,6 @@ version = "0.0.0" dependencies = [ "arrayvec", "askama", - "atty", "expect-test", "itertools", "minifier", diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml index 7bc35c7d551..63ccee14caa 100644 --- a/src/librustdoc/Cargo.toml +++ b/src/librustdoc/Cargo.toml @@ -9,7 +9,6 @@ path = "lib.rs" [dependencies] arrayvec = { version = "0.7", default-features = false } askama = { version = "0.11", default-features = false, features = ["config"] } -atty = "0.2" itertools = "0.10.1" minifier = "0.2.2" once_cell = "1.10.0" diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index ef01b854e5a..7276b9ce0ee 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -8,6 +8,7 @@ #![feature(box_patterns)] #![feature(control_flow_enum)] #![feature(drain_filter)] +#![feature(is_terminal)] #![feature(let_chains)] #![feature(test)] #![feature(never_type)] @@ -69,7 +70,7 @@ extern crate jemalloc_sys; use std::default::Default; use std::env::{self, VarError}; -use std::io; +use std::io::{self, IsTerminal}; use std::process; use rustc_driver::abort_on_err; @@ -180,7 +181,7 @@ fn init_logging() { let color_logs = match std::env::var("RUSTDOC_LOG_COLOR").as_deref() { Ok("always") => true, Ok("never") => false, - Ok("auto") | Err(VarError::NotPresent) => atty::is(atty::Stream::Stdout), + Ok("auto") | Err(VarError::NotPresent) => io::stdout().is_terminal(), Ok(value) => early_error( ErrorOutputType::default(), &format!("invalid log color value '{}': expected one of always, never, or auto", value),