diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2018-05-21 15:32:27 +1200 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2018-05-21 15:32:27 +1200 |
| commit | 6541be3c6f2a8f4f5f5ccd29a793f8ea700a5786 (patch) | |
| tree | abf3635c2fab3042f379924e9b7a6e698addaed5 /src/utils.rs | |
| parent | 9a7fac63c8867fc5cf45b3f262f2e385f6992fb3 (diff) | |
Replace `use_colored_tty` with iatty crate
Diffstat (limited to 'src/utils.rs')
| -rw-r--r-- | src/utils.rs | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/utils.rs b/src/utils.rs index 961989b3f5d..127a7ddb59e 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -18,7 +18,6 @@ use syntax::ast::{ use syntax::codemap::{BytePos, Span, NO_EXPANSION}; use syntax::ptr; -use config::Color; use rewrite::RewriteContext; use shape::Shape; @@ -376,32 +375,6 @@ pub fn left_most_sub_expr(e: &ast::Expr) -> &ast::Expr { } } -// isatty shamelessly adapted from cargo. -#[cfg(unix)] -pub fn isatty() -> bool { - extern crate libc; - - unsafe { libc::isatty(libc::STDOUT_FILENO) != 0 } -} -#[cfg(windows)] -pub fn isatty() -> bool { - extern crate winapi; - - unsafe { - let handle = winapi::um::processenv::GetStdHandle(winapi::um::winbase::STD_OUTPUT_HANDLE); - let mut out = 0; - winapi::um::consoleapi::GetConsoleMode(handle, &mut out) != 0 - } -} - -pub fn use_colored_tty(color: Color) -> bool { - match color { - Color::Always => true, - Color::Never => false, - Color::Auto => isatty(), - } -} - pub fn starts_with_newline(s: &str) -> bool { s.starts_with('\n') || s.starts_with("\r\n") } |
