Use IsTerminal in librustdoc

This commit is contained in:
Josh Triplett 2022-10-16 14:56:03 +01:00
parent d60ba29b10
commit e3d44dd4bd
3 changed files with 3 additions and 4 deletions

View File

@ -4272,7 +4272,6 @@ version = "0.0.0"
dependencies = [
"arrayvec",
"askama",
"atty",
"expect-test",
"itertools",
"minifier",

View File

@ -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"

View File

@ -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),