Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ regex = "0.1"
rustc-serialize = "0.3"
semver = "0.2.0"
tar = "0.4"
term = "0.4"
term = "0.2"
time = "0.1"
toml = "0.1"
url = "0.2"
Expand Down
23 changes: 10 additions & 13 deletions src/cargo/core/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::io::prelude::*;
use std::io;

use term::color::{Color, BLACK, RED, GREEN, YELLOW};
use term::{self, Terminal, TerminfoTerminal, color, Attr};
use term::{Terminal, TerminfoTerminal, color, Attr};

use self::AdequateTerminal::{NoColor, Colored};
use self::Verbosity::{Verbose, Normal, Quiet};
Expand Down Expand Up @@ -193,24 +193,22 @@ impl Shell {
Ok(())
}

fn fg(&mut self, color: color::Color) -> CargoResult<bool> {
fn fg(&mut self, color: color::Color) -> io::Result<bool> {
let colored = self.colored();

match self.terminal {
Colored(ref mut c) if colored => try!(c.fg(color)),
_ => return Ok(false),
Colored(ref mut c) if colored => c.fg(color),
_ => Ok(false),
}
Ok(true)
}

fn attr(&mut self, attr: Attr) -> CargoResult<bool> {
fn attr(&mut self, attr: Attr) -> io::Result<bool> {
let colored = self.colored();

match self.terminal {
Colored(ref mut c) if colored => try!(c.attr(attr)),
_ => return Ok(false)
Colored(ref mut c) if colored => c.attr(attr),
_ => Ok(false)
}
Ok(true)
}

fn supports_attr(&self, attr: Attr) -> bool {
Expand All @@ -222,14 +220,13 @@ impl Shell {
}
}

fn reset(&mut self) -> term::Result<()> {
fn reset(&mut self) -> io::Result<()> {
let colored = self.colored();

match self.terminal {
Colored(ref mut c) if colored => try!(c.reset()),
_ => ()
Colored(ref mut c) if colored => c.reset().map(|_| ()),
_ => Ok(())
}
Ok(())
}

fn colored(&self) -> bool {
Expand Down
3 changes: 0 additions & 3 deletions src/cargo/util/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use curl;
use git2;
use rustc_serialize::json;
use semver;
use term;
use toml;
use url;

Expand Down Expand Up @@ -307,7 +306,6 @@ from_error! {
url::ParseError,
toml::DecodeError,
ffi::NulError,
term::Error,
}

impl<E: CargoError> From<Human<E>> for Box<CargoError> {
Expand All @@ -327,7 +325,6 @@ impl CargoError for toml::Error {}
impl CargoError for toml::DecodeError {}
impl CargoError for url::ParseError {}
impl CargoError for ffi::NulError {}
impl CargoError for term::Error {}

// =============================================================================
// Construction helpers
Expand Down