Skip to content

Commit 75e0371

Browse files
committed
Downgrade term crate back down to 0.2 (from 0.4).
This is undoing part of commit dd34296 Fix #2338 (Unfortunately I do not have a suggestion for how to make a unit test for this problem; doing so would require putting in a bit more effort than I have time for at the moment.)
1 parent 4b447ed commit 75e0371

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ regex = "0.1"
3737
rustc-serialize = "0.3"
3838
semver = "0.2.0"
3939
tar = "0.4"
40-
term = "0.4"
40+
term = "0.2"
4141
time = "0.1"
4242
toml = "0.1"
4343
url = "0.2"

src/cargo/core/shell.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::io::prelude::*;
33
use std::io;
44

55
use term::color::{Color, BLACK, RED, GREEN, YELLOW};
6-
use term::{self, Terminal, TerminfoTerminal, color, Attr};
6+
use term::{Terminal, TerminfoTerminal, color, Attr};
77

88
use self::AdequateTerminal::{NoColor, Colored};
99
use self::Verbosity::{Verbose, Normal, Quiet};
@@ -193,24 +193,22 @@ impl Shell {
193193
Ok(())
194194
}
195195

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

199199
match self.terminal {
200-
Colored(ref mut c) if colored => try!(c.fg(color)),
201-
_ => return Ok(false),
200+
Colored(ref mut c) if colored => c.fg(color),
201+
_ => Ok(false),
202202
}
203-
Ok(true)
204203
}
205204

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

209208
match self.terminal {
210-
Colored(ref mut c) if colored => try!(c.attr(attr)),
211-
_ => return Ok(false)
209+
Colored(ref mut c) if colored => c.attr(attr),
210+
_ => Ok(false)
212211
}
213-
Ok(true)
214212
}
215213

216214
fn supports_attr(&self, attr: Attr) -> bool {
@@ -222,14 +220,13 @@ impl Shell {
222220
}
223221
}
224222

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

228226
match self.terminal {
229-
Colored(ref mut c) if colored => try!(c.reset()),
230-
_ => ()
227+
Colored(ref mut c) if colored => c.reset().map(|_| ()),
228+
_ => Ok(())
231229
}
232-
Ok(())
233230
}
234231

235232
fn colored(&self) -> bool {

src/cargo/util/errors.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use curl;
99
use git2;
1010
use rustc_serialize::json;
1111
use semver;
12-
use term;
1312
use toml;
1413
use url;
1514

@@ -307,7 +306,6 @@ from_error! {
307306
url::ParseError,
308307
toml::DecodeError,
309308
ffi::NulError,
310-
term::Error,
311309
}
312310

313311
impl<E: CargoError> From<Human<E>> for Box<CargoError> {
@@ -327,7 +325,6 @@ impl CargoError for toml::Error {}
327325
impl CargoError for toml::DecodeError {}
328326
impl CargoError for url::ParseError {}
329327
impl CargoError for ffi::NulError {}
330-
impl CargoError for term::Error {}
331328

332329
// =============================================================================
333330
// Construction helpers

0 commit comments

Comments
 (0)