From 2c809381b7116ce70b9302cc8bfac8a6b4a0f7c7 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Sat, 5 Jun 2021 21:53:53 -0400 Subject: [PATCH] Revert "Add colors" This reverts commit 9fd68c94cf4dd8ba6fbc8c96e44851eb22bd1e09. --- Cargo.lock | 1 - src/bootstrap/Cargo.toml | 1 - src/bootstrap/builder.rs | 27 +++++---------------------- src/bootstrap/flags.rs | 12 ------------ 4 files changed, 5 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f99d322ab168..270297f73b63 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -183,7 +183,6 @@ dependencies = [ "pretty_assertions", "serde", "serde_json", - "termcolor", "time", "toml", "winapi 0.3.9", diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml index 468419cd4140..8445d811e0f3 100644 --- a/src/bootstrap/Cargo.toml +++ b/src/bootstrap/Cargo.toml @@ -50,7 +50,6 @@ time = "0.1" ignore = "0.4.10" opener = "0.4" merge = "0.1.0" -termcolor = "1.0" [target.'cfg(windows)'.dependencies.winapi] version = "0.3" diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 2cb643193cd9..0d0565271ed4 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -14,7 +14,6 @@ use std::time::{Duration, Instant}; use build_helper::{output, t}; use lazy_static::lazy_static; -use termcolor::{ColorSpec, WriteColor}; use crate::cache::{Cache, Interned, INTERNER}; use crate::check; @@ -1568,7 +1567,6 @@ impl<'a> Builder<'a> { let (out, dur) = { let instructions = ReplicationStep { - color: self.build.config.color, cmd: self.kind, name: step.name(), path: step.path(self), @@ -1610,7 +1608,6 @@ impl<'a> Builder<'a> { } struct ReplicationStep { - color: Color, cmd: Kind, name: &'static str, path: PathBuf, @@ -1623,34 +1620,20 @@ lazy_static! { } pub(crate) extern "C" fn print_replication_steps() { - use std::io::Write; if let Some(step) = CURRENT_INSTRUCTIONS.lock().expect("mutex guard is dropped on panic").take() { - let mut stdout = termcolor::StandardStream::stdout(step.color.into()); // ignore errors; we're exiting anyway - let mut yellow = ColorSpec::new(); - yellow.set_fg(Some(termcolor::Color::Yellow)); - let _ = stdout.set_color(&yellow); - let _ = write!(stdout, "note"); - let _ = stdout.reset(); - let _ = writeln!(stdout, ": failed while building {}", step.name); - - let mut blue = ColorSpec::new(); - blue.set_fg(Some(termcolor::Color::Blue)); - let _ = stdout.set_color(&blue); - let _ = write!(stdout, "help"); - let _ = stdout.reset(); - let _ = write!( - stdout, - ": to replicate this failure, run `./x.py {} {} --stage {}", + println!("note: failed while building {}", step.name); + print!( + "help: to replicate this failure, run `./x.py {} {} --stage {}", step.cmd, step.path.display(), step.stage, ); for arg in step.test_args { - let _ = write!(stdout, " --test-args \"{}\"", arg); + print!(" --test-args \"{}\"", arg); } - let _ = writeln!(stdout, "`"); + println!("`"); } } diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index ac6f5ca590bb..80a60c79edfe 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -9,14 +9,12 @@ use std::process; use build_helper::t; use getopts::Options; -use termcolor::ColorChoice; use crate::builder::Builder; use crate::config::{Config, TargetSelection}; use crate::setup::Profile; use crate::{Build, DocTests}; -#[derive(Copy, Clone)] pub enum Color { Always, Never, @@ -29,16 +27,6 @@ impl Default for Color { } } -impl From for ColorChoice { - fn from(c: Color) -> Self { - match c { - Color::Always => ColorChoice::Always, - Color::Never => ColorChoice::Never, - Color::Auto => ColorChoice::Auto, - } - } -} - impl std::str::FromStr for Color { type Err = ();