Use IsTerminal in librustdoc
This commit is contained in:
parent
d60ba29b10
commit
e3d44dd4bd
3 changed files with 3 additions and 4 deletions
|
@ -4272,7 +4272,6 @@ version = "0.0.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arrayvec",
|
"arrayvec",
|
||||||
"askama",
|
"askama",
|
||||||
"atty",
|
|
||||||
"expect-test",
|
"expect-test",
|
||||||
"itertools",
|
"itertools",
|
||||||
"minifier",
|
"minifier",
|
||||||
|
|
|
@ -9,7 +9,6 @@ path = "lib.rs"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arrayvec = { version = "0.7", default-features = false }
|
arrayvec = { version = "0.7", default-features = false }
|
||||||
askama = { version = "0.11", default-features = false, features = ["config"] }
|
askama = { version = "0.11", default-features = false, features = ["config"] }
|
||||||
atty = "0.2"
|
|
||||||
itertools = "0.10.1"
|
itertools = "0.10.1"
|
||||||
minifier = "0.2.2"
|
minifier = "0.2.2"
|
||||||
once_cell = "1.10.0"
|
once_cell = "1.10.0"
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(control_flow_enum)]
|
#![feature(control_flow_enum)]
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
|
#![feature(is_terminal)]
|
||||||
#![feature(let_chains)]
|
#![feature(let_chains)]
|
||||||
#![feature(test)]
|
#![feature(test)]
|
||||||
#![feature(never_type)]
|
#![feature(never_type)]
|
||||||
|
@ -69,7 +70,7 @@ extern crate jemalloc_sys;
|
||||||
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::env::{self, VarError};
|
use std::env::{self, VarError};
|
||||||
use std::io;
|
use std::io::{self, IsTerminal};
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
use rustc_driver::abort_on_err;
|
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() {
|
let color_logs = match std::env::var("RUSTDOC_LOG_COLOR").as_deref() {
|
||||||
Ok("always") => true,
|
Ok("always") => true,
|
||||||
Ok("never") => false,
|
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(
|
Ok(value) => early_error(
|
||||||
ErrorOutputType::default(),
|
ErrorOutputType::default(),
|
||||||
&format!("invalid log color value '{}': expected one of always, never, or auto", value),
|
&format!("invalid log color value '{}': expected one of always, never, or auto", value),
|
||||||
|
|
Loading…
Add table
Reference in a new issue