]> git.proxmox.com Git - cargo.git/commitdiff
Removes macro and conflicting impls
authorFelipe Sere <felipesere@gmail.com>
Wed, 17 Dec 2014 21:18:24 +0000 (21:18 +0000)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 30 Dec 2014 02:35:54 +0000 (18:35 -0800)
src/cargo/util/errors.rs

index 2d4ccdf75cd5f539894b72bb6951db85b27a0bab..38eb793b986d0adb842d2ee70b56ba5aecb07a67 100644 (file)
@@ -28,22 +28,6 @@ pub trait CargoError: Send {
     }
 }
 
-impl<E: CargoError> FromError<E> for Box<CargoError> {
-    fn from_error(error: E) -> Box<CargoError> {
-        box error as Box<CargoError>
-    }
-}
-
-macro_rules! from_error {
-    ($ty:ty) => {
-        impl FromError<$ty> for $ty {
-            fn from_error(error: $ty) -> $ty {
-                error
-            }
-        }
-    }
-}
-
 impl Show for Box<CargoError> {
     fn fmt(&self, f: &mut Formatter) -> fmt::Result {
         try!(write!(f, "{}", self.description()));
@@ -96,34 +80,24 @@ impl CargoError for IoError {
     fn description(&self) -> String { self.to_string() }
 }
 
-from_error!(IoError);
-
 impl CargoError for TomlError {
     fn description(&self) -> String { self.to_string() }
 }
 
-from_error!(TomlError);
-
 impl CargoError for fmt::Error {
     fn description(&self) -> String {
         "formatting failed".to_string()
     }
 }
 
-from_error!(fmt::Error);
-
 impl CargoError for curl::ErrCode {
     fn description(&self) -> String { self.to_string() }
 }
 
-from_error!(curl::ErrCode);
-
 impl CargoError for json::DecoderError {
     fn description(&self) -> String { self.to_string() }
 }
 
-from_error!(json::DecoderError);
-
 pub struct ProcessError {
     pub msg: String,
     pub exit: Option<ProcessExit>,
@@ -132,8 +106,6 @@ pub struct ProcessError {
     pub cause: Option<Box<CargoError>>
 }
 
-from_error!(ProcessError);
-
 impl Show for ProcessError {
     fn fmt(&self, f: &mut Formatter) -> fmt::Result {
         let exit = match self.exit {
@@ -244,8 +216,6 @@ impl CargoError for CliError {
     }
 }
 
-from_error!(CliError);
-
 impl CargoError for docopt::Error {
     fn description(&self) -> String {
         match *self {
@@ -266,20 +236,14 @@ impl CargoError for docopt::Error {
     fn is_human(&self) -> bool { true }
 }
 
-from_error!(docopt::Error);
-
 impl CargoError for url::ParseError {
     fn description(&self) -> String { self.to_string() }
 }
 
-from_error!(url::ParseError);
-
 impl CargoError for git2::Error {
     fn description(&self) -> String { self.to_string() }
 }
 
-from_error!(git2::Error);
-
 impl CliError {
     pub fn new<S: Str>(error: S, code: uint) -> CliError {
         let error = human(error.as_slice().to_string());