Skip to content

Commit

Permalink
Don't call generic methods on trait objects
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Jul 1, 2014
1 parent fe2d2e6 commit 8b5d626
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
6 changes: 4 additions & 2 deletions src/bin/cargo-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use cargo::ops;
use cargo::{execute_main_without_stdin};
use cargo::core::{MultiShell};
use cargo::util;
use cargo::util::{CliResult, CliError};
use cargo::util::{CliResult, CliError, CargoError};
use cargo::util::important_paths::find_project_manifest;

#[deriving(PartialEq,Clone,Decodable)]
Expand Down Expand Up @@ -56,7 +56,9 @@ fn execute(options: Options, shell: &mut MultiShell) -> CliResult<Option<()>> {
}));

for file in walk {
try!(util::process(file).exec().map_err(|e| CliError::from_boxed(e.box_error(), 1)));
try!(util::process(file).exec().map_err(|e| {
CliError::from_boxed(e.box_error(), 1)
}));
}

Ok(None)
Expand Down
5 changes: 1 addition & 4 deletions src/cargo/core/package_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,7 @@ impl<D: Decoder<Box<CargoError + Send>>>
for PackageId
{
fn decode(d: &mut D) -> Result<PackageId, Box<CargoError + Send>> {
let vector: Vec<String> = match Decodable::decode(d) {
Ok(v) => v,
Err(e) => return Err(e.to_error())
};
let vector: Vec<String> = try!(Decodable::decode(d));

PackageId::new(
vector.get(0).as_slice(),
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ mod cargo {
#[macro_export]
macro_rules! try (
($expr:expr) => ({
use cargo::util::CargoError;
match $expr.map_err(|err| err.to_error()) {
use cargo::util::FromError;
match $expr.map_err(FromError::from_error) {
Ok(val) => val,
Err(err) => return Err(err)
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::collections::HashMap;
use serialize::{Encodable,Encoder};
use toml;
use core::MultiShell;
use util::{CargoResult, CargoError, ChainError, Require, internal, human};
use util::{CargoResult, ChainError, Require, internal, human};

use cargo_toml = util::toml;

Expand Down

0 comments on commit 8b5d626

Please sign in to comment.