From ad2d993b68901c02aa1f928d805ce95a9f9bb041 Mon Sep 17 00:00:00 2001 From: Sam Rijs Date: Tue, 6 Mar 2018 21:02:00 +1100 Subject: [PATCH] use external shared_failure crate --- Cargo.lock | 6 ++++-- Cargo.toml | 5 +---- libs/shared-failure/Cargo.toml | 7 ------- libs/shared-failure/src/lib.rs | 37 ---------------------------------- 4 files changed, 5 insertions(+), 50 deletions(-) delete mode 100644 libs/shared-failure/Cargo.toml delete mode 100644 libs/shared-failure/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 2d8b30c..3a6d875 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -684,8 +684,9 @@ dependencies = [ ] [[package]] -name = "shared-failure" +name = "shared_failure" version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -711,7 +712,7 @@ dependencies = [ "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)", - "shared-failure 0.1.0", + "shared_failure 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "slog 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "slog-json 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1038,6 +1039,7 @@ dependencies = [ "checksum serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0" "checksum serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5" "checksum serde_json 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c9db7266c7d63a4c4b7fe8719656ccdd51acf1bed6124b174f933b009fb10bcb" +"checksum shared_failure 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "95950ce835eb54ad4d85f5f597a3d7f78cb0f6622f65dabc2dac915d9edc404a" "checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23" "checksum slab 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fdeff4cd9ecff59ec7e3744cbca73dfe5ac35c2aedb2cfba8a1c715a18912e9d" "checksum slog 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6b13b17f4225771f7f15cece704a4e68d3a5f31278ed26367f497133398a18" diff --git a/Cargo.toml b/Cargo.toml index 46ebd41..e3020a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ semver = { version = "0.9.0", features = ["serde"] } serde = "1.0.27" serde_derive = "1.0.27" serde_json = "1.0.9" +shared_failure = "0.1.0" slog = "2.1.1" slog-json = "2.2.0" tokio-core = "0.1.12" @@ -29,9 +30,5 @@ toml = "0.4.5" version = "0.2.0" path = "libs/badge" -[dependencies.shared-failure] -version = "0.1.0" -path = "libs/shared-failure" - [build-dependencies] sass-rs = "0.2.1" diff --git a/libs/shared-failure/Cargo.toml b/libs/shared-failure/Cargo.toml deleted file mode 100644 index b03dd19..0000000 --- a/libs/shared-failure/Cargo.toml +++ /dev/null @@ -1,7 +0,0 @@ -[package] -name = "shared-failure" -version = "0.1.0" -authors = ["Sam Rijs "] - -[dependencies] -failure = "0.1.1" diff --git a/libs/shared-failure/src/lib.rs b/libs/shared-failure/src/lib.rs deleted file mode 100644 index 8b728d0..0000000 --- a/libs/shared-failure/src/lib.rs +++ /dev/null @@ -1,37 +0,0 @@ -extern crate failure; - -use std::fmt::{Display, Formatter, Result as FmtResult}; -use std::sync::Arc; - -use failure::{Backtrace, Error, Fail}; - -#[derive(Clone, Debug)] -pub struct SharedFailure(Arc); - -impl SharedFailure { - pub fn downcast_ref(&self) -> Option<&T> { - self.0.downcast_ref() - } -} - -impl Fail for SharedFailure { - fn cause(&self) -> Option<&Fail> { - Some(self.0.cause()) - } - - fn backtrace(&self) -> Option<&Backtrace> { - Some(self.0.backtrace()) - } -} - -impl Display for SharedFailure { - fn fmt(&self, f: &mut Formatter) -> FmtResult { - self.0.fmt(f) - } -} - -impl From for SharedFailure { - fn from(err: Error) -> SharedFailure { - SharedFailure(Arc::new(err)) - } -}