diff --git a/Cargo.lock b/Cargo.lock index a2d750066d9..ee26f7e1ff4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,7 +25,7 @@ dependencies = [ "semver 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "tar 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "term 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "term 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.34 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", "url 0.2.38 (registry+https://github.com/rust-lang/crates.io-index)", @@ -395,7 +395,7 @@ dependencies = [ [[package]] name = "term" -version = "0.4.0" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index ed3e7cb8e97..5e3c52d590b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/cargo/core/shell.rs b/src/cargo/core/shell.rs index 14cc5f38794..cc764dcb664 100644 --- a/src/cargo/core/shell.rs +++ b/src/cargo/core/shell.rs @@ -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}; @@ -193,24 +193,22 @@ impl Shell { Ok(()) } - fn fg(&mut self, color: color::Color) -> CargoResult { + fn fg(&mut self, color: color::Color) -> io::Result { 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 { + fn attr(&mut self, attr: Attr) -> io::Result { 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 { @@ -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 { diff --git a/src/cargo/util/errors.rs b/src/cargo/util/errors.rs index 54934e10baa..e2ba109f3b2 100644 --- a/src/cargo/util/errors.rs +++ b/src/cargo/util/errors.rs @@ -9,7 +9,6 @@ use curl; use git2; use rustc_serialize::json; use semver; -use term; use toml; use url; @@ -307,7 +306,6 @@ from_error! { url::ParseError, toml::DecodeError, ffi::NulError, - term::Error, } impl From> for Box { @@ -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