Repository: rust-lang-deprecated/failure (language: rust)

Issue:
Improve error message on missing field lookup in derive code
This is for the `0.1.X` version of `failure_derive`


Discussion / hints:

Fix patch:
diff --git a/.travis.yml b/.travis.yml
index 6443aa2..61d8965 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,4 +1,3 @@
-sudo: false
 language: rust
 rust:
     - 1.18.0
@@ -6,4 +5,7 @@ rust:
     - beta
     - nightly
 cache: cargo
-script: bash travis.sh
+script:
+  - cargo test
+  - cargo test --features backtrace
+  - cargo check --no-default-features
diff --git a/failure-1.X/Cargo.toml b/Cargo.toml
similarity index 73%
rename from failure-1.X/Cargo.toml
rename to Cargo.toml
index 4bd5c86..34dbc49 100644
--- a/failure-1.X/Cargo.toml
+++ b/Cargo.toml
@@ -6,17 +6,13 @@ homepage = "https://boats.gitlab.io/failure"
 license = "MIT OR Apache-2.0"
 name = "failure"
 repository = "https://github.com/rust-lang-nursery/failure"
-version = "1.0.0"
+version = "0.1.2"
 
 [dependencies.failure_derive]
 optional = true
-version = "1.0.0"
+version = "0.1.2"
 path = "./failure_derive"
 
-[dependencies.display_derive]
-optional = true
-git = "https://github.com/withoutboats/display_derive"
-
 [dependencies.backtrace]
 optional = true
 version = "0.3.3"
@@ -25,4 +21,4 @@ version = "0.3.3"
 default = ["std", "derive"]
 #small-error = ["std"]
 std = []
-derive = ["failure_derive", "display_derive"]
+derive = ["failure_derive"]
diff --git a/failure-0.1.X/examples/bail_ensure.rs b/examples/bail_ensure.rs
similarity index 100%
rename from failure-0.1.X/examples/bail_ensure.rs
rename to examples/bail_ensure.rs
diff --git a/examples/simple.rs b/examples/simple.rs
new file mode 100644
index 0000000..c9cc7f4
--- /dev/null
+++ b/examples/simple.rs
@@ -0,0 +1,14 @@
+#[macro_use]
+extern crate failure;
+
+#[derive(Fail, Debug)]
+#[fail(display = "my error")]
+struct MyError;
+
+fn bad_function() -> Result<(), MyError> {
+    Err(MyError)
+}
+
+fn main() {
+    println!("{}", bad_function().unwrap_err());
+}
diff --git a/failure-0.1.X/Cargo.toml b/failure-0.1.X/Cargo.toml
deleted file mode 100644
index cf9bb16..0000000
--- a/failure-0.1.X/Cargo.toml
+++ /dev/null
@@ -1,30 +0,0 @@
-[package]
-authors = ["Without Boats <boats@mozilla.com>"]
-description = "Experimental error handling abstraction."
-documentation = "https://docs.rs/failure"
-homepage = "https://boats.gitlab.io/failure"
-license = "MIT OR Apache-2.0"
-name = "failure"
-repository = "https://github.com/withoutboats/failure"
-version = "0.1.2"
-
-[dependencies.failure_compat_shim]
-version = "1.0.0"
-path = "../failure_compat_shim"
-default-features = false
-
-[dependencies.failure_derive]
-optional = true
-version = "0.1.2"
-path = "./failure_derive"
-
-[features]
-default = ["std", "derive"]
-backtrace = ["failure_compat_shim/backtrace"]
-std = ["backtrace", "failure_compat_shim/std"]
-derive = ["failure_derive", "failure_compat_shim/derive"]
-
-[[example]]
-name = "bail_ensure"
-path = "./examples/bail_ensure.rs"
-required-features = ["std"]
diff --git a/failure-0.1.X/src/lib.rs b/failure-0.1.X/src/lib.rs
deleted file mode 100644
index f066d54..0000000
--- a/failure-0.1.X/src/lib.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-//! An experimental new error-handling library. Guide-style introduction
-//! is available [here](https://boats.gitlab.io/failure/).
-//!
-//! The primary items exported by this library are:
-//!
-//! - `Fail`: a new trait for custom error types in Rust.
-//! - `Error`: a wrapper around `Fail` types to make it easy to coalesce them
-//!   at higher levels.
-//!
-//! As a general rule, library authors should create their own error types and
-//! implement `Fail` for them, whereas application authors should primarily
-//! deal with the `Error` type. There are exceptions to this rule, though, in
-//! both directions, and users should do whatever seems most appropriate to
-//! their situation.
-#![cfg_attr(not(feature = "std"), no_std)]
-#![deny(missing_docs)]
-
-macro_rules! with_std { ($($i:item)*) => ($(#[cfg(feature = "std")]$i)*) }
-
-extern crate failure_compat_shim as failure;
-
-#[cfg(feature = "derive")]
-#[allow(unused_imports)]
-#[macro_use]
-extern crate failure_derive;
-
-#[cfg(feature = "derive")]
-#[doc(hidden)]
-pub use failure_derive::*;
-
-pub use failure::{Fail, Causes, Backtrace, Context, Compat, ResultExt};
-
-with_std! {
-    extern crate core;
-
-    pub use failure::{Error, SyncFailure, err_msg};
-
-    mod macros;
-}
diff --git a/failure-1.X/.gitignore b/failure-1.X/.gitignore
deleted file mode 100644
index 1bc55b7..0000000
--- a/failure-1.X/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-**/target/
-**/*.rs.bk
-**/Cargo.lock
-public
-book/book
diff --git a/failure-1.X/.gitlab-ci.yml b/failure-1.X/.gitlab-ci.yml
deleted file mode 100644
index a9cbe35..0000000
--- a/failure-1.X/.gitlab-ci.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-image: "rust:latest"
-
-pages:
-  script:
-    - sh ./build-docs.sh
-  artifacts:
-    paths:
-      - public
-  only:
-    - master
diff --git a/failure-1.X/.travis.yml b/failure-1.X/.travis.yml
deleted file mode 100644
index c771d1a..0000000
--- a/failure-1.X/.travis.yml
+++ /dev/null
@@ -1,10 +0,0 @@
-language: rust
-rust:
-    - 1.18.0
-    - stable
-    - beta
-    - nightly
-cache: cargo
-script:
-- cargo test
-- cargo test --no-default-features
diff --git a/failure-1.X/failure_derive/.gitignore b/failure-1.X/failure_derive/.gitignore
deleted file mode 100644
index fa8d85a..0000000
--- a/failure-1.X/failure_derive/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Cargo.lock
-target
diff --git a/failure-1.X/failure_derive/.travis.yml b/failure-1.X/failure_derive/.travis.yml
deleted file mode 100644
index 5f4d6d1..0000000
--- a/failure-1.X/failure_derive/.travis.yml
+++ /dev/null
@@ -1,7 +0,0 @@
-language: rust
-rust:
-    - 1.18.0
-    - stable
-    - beta
-    - nightly
-cache: cargo
diff --git a/failure-1.X/failure_derive/Cargo.toml b/failure-1.X/failure_derive/Cargo.toml
deleted file mode 100644
index 0f2fa8d..0000000
--- a/failure-1.X/failure_derive/Cargo.toml
+++ /dev/null
@@ -1,27 +0,0 @@
-[package]
-authors = ["Without Boats <woboats@gmail.com>"]
-description = "derives for the failure crate"
-license = "MIT OR Apache-2.0"
-name = "failure_derive"
-homepage = "https://boats.gitlab.io/failure"
-documentation = "https://boats.gitlab.io/failure"
-version = "1.0.0"
-
-[dependencies]
-quote = "0.6"
-syn = "0.14"
-synstructure = "0.9"
-proc-macro2 = "0.4"
-
-[dev-dependencies.failure]
-version = "0.1.0"
-
-[dev-dependencies.display_derive]
-git = "https://github.com/withoutboats/display_derive"
-
-[lib]
-proc-macro = true
-
-[features]
-default = ["std"]
-std = []
diff --git a/failure-1.X/failure_derive/src/lib.rs b/failure-1.X/failure_derive/src/lib.rs
deleted file mode 100644
index f75ccc3..0000000
--- a/failure-1.X/failure_derive/src/lib.rs
+++ /dev/null
@@ -1,90 +0,0 @@
-extern crate proc_macro;
-
-#[macro_use] extern crate syn;
-#[macro_use] extern crate synstructure;
-#[macro_use] extern crate quote;
-extern crate proc_macro2;
-
-use proc_macro2::TokenStream;
-
-decl_derive!([Fail, attributes(fail, cause)] => fail_derive);
-
-fn fail_derive(s: synstructure::Structure) -> TokenStream {
-    let cause_body = s.each_variant(|v| {
-        if let Some(cause) = v.bindings().iter().find(is_cause) {
-            quote!(return Some(#cause))
-        } else {
-            quote!(return None)
-        }
-    });
-
-    let bt_body = s.each_variant(|v| {
-        if let Some(bi) = v.bindings().iter().find(is_backtrace) {
-            quote!(return Some(#bi))
-        } else {
-            quote!(return None)
-        }
-    });
-
-    #[cfg(feature = "std")]
-    let fail = s.bound_impl(quote!(::failure::Fail), quote! {
-        #[allow(unreachable_code)]
-        fn cause(&self) -> ::std::option::Option<&::failure::Fail> {
-            match *self { #cause_body }
-            None
-        }
-
-        #[allow(unreachable_code)]
-        fn backtrace(&self) -> ::std::option::Option<&::failure::Backtrace> {
-            match *self { #bt_body }
-            None
-        }
-    });
-
-    #[cfg(not(feature = "std"))]
-    let fail = s.bound_impl(quote!(::failure::Fail), quote! {
-        #[allow(unreachable_code)]
-        fn cause(&self) -> ::core::option::Option<&::failure::Fail> {
-            match *self { #cause_body }
-            None
-        }
-
-        #[allow(unreachable_code)]
-        fn backtrace(&self) -> ::core::option::Option<&::failure::Backtrace> {
-            match *self { #bt_body }
-            None
-        }
-    });
-
-    quote! {
-        #fail
-    }
-}
-
-fn is_backtrace(bi: &&synstructure::BindingInfo) -> bool {
-        match bi.ast().ty {
-            syn::Type::Path(syn::TypePath { qself: None, path: syn::Path { ref segments, .. } }) => {
-                segments.last().map_or(false, |p| p.value().ident == "Backtrace" && p.value().arguments.is_empty())
-            }
-            _ => false
-        }
-}
-
-fn is_cause(bi: &&synstructure::BindingInfo) -> bool {
-    let mut found_cause = false;
-    for attr in &bi.ast().attrs {
-        if attr.path == parse_quote!(fail) {
-            if let Some(syn::Meta::List(ref list)) = attr.interpret_meta() {
-                if let Some(pair) = list.nested.first() {
-                    if let &syn::NestedMeta::Meta(syn::Meta::Word(ref word)) = pair.into_value() {
-                        if word == "cause" {
-                            if found_cause { panic!("Cannot have two `cause` attributes"); }
-                            found_cause = true;
-                        }
-                    }
-                }
-            }
-        }
-    }
-    found_cause
-}
diff --git a/failure-1.X/src/macros.rs b/failure-1.X/src/macros.rs
deleted file mode 100644
index aa2ce9b..0000000
--- a/failure-1.X/src/macros.rs
+++ /dev/null
@@ -1,93 +0,0 @@
-/// "Throw" an error, returning it early.
-/// 
-/// Like the `?` operator, this performs a conversion into the return type of
-/// the function you are early returning from.
-/// 
-/// ```
-/// #[macro_use] extern crate failure;
-///
-/// #[derive(Fail, Debug, Display)]
-/// #[display(fmt = "An error occurred.")]
-/// struct CustomFailure;
-/// 
-/// fn example(success: bool) -> Result<(), failure::Error> {
-///     if !success {
-///         throw!(CustomFailure);
-///     }
-///
-///     Ok(())
-/// }
-///
-/// # fn main() {
-/// #     assert!(example(true).is_ok());
-/// #     assert!(example(false).is_err());
-/// # }
-/// ```
-#[macro_export]
-macro_rules! throw {
-    ($e:expr) => {
-        return Err(::std::convert::Into::into($e));
-    }
-}
-
-/// Early return with an error made from a string.
-/// 
-/// Unlike `throw!`, which expects a type that implements `Fail`, `bail!`
-/// expects to receive standard string interpolation.
-///
-/// ```
-/// #[macro_use] extern crate failure;
-///
-/// fn example(success: bool) -> Result<(), failure::Error> {
-///     if !success {
-///         bail!("Unsuccessful: {}", success);
-///     }
-///
-///     Ok(())
-/// }
-///
-/// # fn main() {
-/// #     assert!(example(true).is_ok());
-/// #     assert!(example(false).is_err());
-/// # }
-/// ```
-#[macro_export]
-macro_rules! bail {
-    ($e:expr) => {
-        return Err($crate::err_msg::<&'static str>($e));
-    };
-    ($fmt:expr, $($arg:tt)+) => {
-        return Err($crate::err_msg::<String>(format!($fmt, $($arg)+)));
-    };
-}
-
-/// Early return with a string-based error if a condition isn't met.
-/// 
-/// If `bail!` is analogous to `panic!`, `ensure!` is analogous to `assert!`.
-/// 
-/// Like the `bail!` macro, this must take a string, it cannot take an
-/// arbitrary error type. If you want to throw a custom error, you should
-/// use an `if` statement and the `throw!` macro.
-#[macro_export]
-macro_rules! ensure {
-    ($cond:expr, $e:expr) => {
-        if !($cond) {
-            bail!($e);
-        }
-    };
-    ($cond:expr, $fmt:expr, $($arg:tt)+) => {
-        if !($cond) {
-            bail!($fmt, $($arg)+);
-        }
-    };
-}
-
-/// Construct an error from a format string without returning it.
-/// 
-/// Unlike `bail!`, this does not terminate the function, it just evaluates
-/// to an `Error`, which you can do other things with.
-#[macro_export]
-macro_rules! format_err {
-    ($e:expr) => { $crate::err_msg::<&'static str>($e) };
-    ($fmt:expr, $($arg:tt)+) => { $crate::err_msg::<String>(format!($fmt, $($arg)+)) };
-}
diff --git a/failure_compat_shim/Cargo.toml b/failure_compat_shim/Cargo.toml
deleted file mode 100644
index 06c05a5..0000000
--- a/failure_compat_shim/Cargo.toml
+++ /dev/null
@@ -1,15 +0,0 @@
-[package]
-name = "failure_compat_shim"
-version = "1.0.0"
-authors = ["boats <boats@mozilla.com>"]
-
-[dependencies.failure]
-version = "1.0.0"
-path = "../failure-1.X"
-default-features = false
-
-[features]
-default = ["std", "derive"]
-backtrace = ["failure/backtrace"]
-std = ["backtrace", "failure/std"]
-derive = ["failure/derive"]
diff --git a/failure_compat_shim/src/lib.rs b/failure_compat_shim/src/lib.rs
deleted file mode 100644
index 9047715..0000000
--- a/failure_compat_shim/src/lib.rs
+++ /dev/null
@@ -1,3 +0,0 @@
-extern crate failure;
-
-pub use failure::*;
diff --git a/failure-0.1.X/failure_derive/.gitignore b/failure_derive/.gitignore
similarity index 100%
rename from failure-0.1.X/failure_derive/.gitignore
rename to failure_derive/.gitignore
diff --git a/failure-0.1.X/failure_derive/.travis.yml b/failure_derive/.travis.yml
similarity index 100%
rename from failure-0.1.X/failure_derive/.travis.yml
rename to failure_derive/.travis.yml
diff --git a/failure-0.1.X/failure_derive/Cargo.toml b/failure_derive/Cargo.toml
similarity index 100%
rename from failure-0.1.X/failure_derive/Cargo.toml
rename to failure_derive/Cargo.toml
diff --git a/failure-0.1.X/failure_derive/src/lib.rs b/failure_derive/src/lib.rs
similarity index 93%
rename from failure-0.1.X/failure_derive/src/lib.rs
rename to failure_derive/src/lib.rs
index 0b19202..ad4698d 100644
--- a/failure-0.1.X/failure_derive/src/lib.rs
+++ b/failure_derive/src/lib.rs
@@ -4,7 +4,6 @@ extern crate syn;
 #[macro_use] extern crate synstructure;
 #[macro_use] extern crate quote;
 
-use std::io::{self, Write};
 use proc_macro2::TokenStream;
 
 decl_derive!([Fail, attributes(fail, cause)] => fail_derive);
@@ -102,7 +101,7 @@ fn display_body(s: &synstructure::Structure) -> Option<quote::__rt::TokenStream>
             panic!("Expected at least one argument to fail attribute");
         }
 
-        let s = match msg.nested[0] {
+        let format_string = match msg.nested[0] {
             syn::NestedMeta::Meta(syn::Meta::NameValue(ref nv)) if nv.ident == "display" => {
                 nv.lit.clone()
             }
@@ -126,13 +125,13 @@ fn display_body(s: &synstructure::Structure) -> Option<quote::__rt::TokenStream>
                         return quote!(#bi);
                     }
                 }
-                panic!("Couldn't find a field with this name!");
+                panic!("Couldn't find field `{}` in `{}::{}`", id, s.ast().ident, v.ast().ident);
             }
             _ => panic!("Invalid argument to fail attribute!"),
         });
 
         quote! {
-            return write!(f, #s #(, #args)*)
+            return write!(f, #format_string #(, #args)*)
         }
     }))
 }
@@ -148,7 +147,7 @@ fn find_error_msg(attrs: &[syn::Attribute]) -> Option<syn::MetaList> {
                     if let syn::Meta::List(list)  = meta {
                         error_msg = Some(list);
                     } else {
-                        panic!("fail attribute must take a list in parantheses")
+                        panic!("fail attribute must take a list in parentheses")
                     }
                 }
             }
@@ -177,11 +176,6 @@ fn is_cause(bi: &&synstructure::BindingInfo) -> bool {
         if let Some(meta) = attr.interpret_meta() {
             if meta.name() == "cause" {
                 if found_cause { panic!("Cannot have two `cause` attributes"); }
-                writeln!(
-                    io::stderr(),
-                    "WARNING: failure's `#[cause]` attribute is deprecated. \
-                     Use `#[fail(cause)]` instead."
-                ).unwrap();
                 found_cause = true;
             }
             if meta.name() == "fail" {
diff --git a/failure-1.X/src/backtrace/internal.rs b/src/backtrace/internal.rs
similarity index 100%
rename from failure-1.X/src/backtrace/internal.rs
rename to src/backtrace/internal.rs
diff --git a/failure-1.X/src/backtrace/mod.rs b/src/backtrace/mod.rs
similarity index 100%
rename from failure-1.X/src/backtrace/mod.rs
rename to src/backtrace/mod.rs
diff --git a/failure-1.X/src/compat.rs b/src/compat.rs
similarity index 100%
rename from failure-1.X/src/compat.rs
rename to src/compat.rs
diff --git a/failure-1.X/src/context.rs b/src/context.rs
similarity index 100%
rename from failure-1.X/src/context.rs
rename to src/context.rs
diff --git a/failure-1.X/src/error/error_impl.rs b/src/error/error_impl.rs
similarity index 100%
rename from failure-1.X/src/error/error_impl.rs
rename to src/error/error_impl.rs
diff --git a/failure-1.X/src/error/error_impl_small.rs b/src/error/error_impl_small.rs
similarity index 100%
rename from failure-1.X/src/error/error_impl_small.rs
rename to src/error/error_impl_small.rs
diff --git a/failure-1.X/src/error/mod.rs b/src/error/mod.rs
similarity index 100%
rename from failure-1.X/src/error/mod.rs
rename to src/error/mod.rs
diff --git a/failure-1.X/src/error_message.rs b/src/error_message.rs
similarity index 100%
rename from failure-1.X/src/error_message.rs
rename to src/error_message.rs
diff --git a/failure-1.X/src/lib.rs b/src/lib.rs
similarity index 97%
rename from failure-1.X/src/lib.rs
rename to src/lib.rs
index 044e4f0..30a1fd4 100644
--- a/failure-1.X/src/lib.rs
+++ b/src/lib.rs
@@ -50,15 +50,6 @@ extern crate failure_derive;
 #[doc(hidden)]
 pub use failure_derive::*;
 
-#[cfg(feature = "display_derive")]
-#[allow(unused_imports)]
-#[macro_use]
-extern crate display_derive;
-
-#[cfg(feature = "display_derive")]
-#[doc(hidden)]
-pub use display_derive::*;
-
 with_std! {
     extern crate core;
 
diff --git a/failure-0.1.X/src/macros.rs b/src/macros.rs
similarity index 100%
rename from failure-0.1.X/src/macros.rs
rename to src/macros.rs
diff --git a/failure-1.X/src/result_ext.rs b/src/result_ext.rs
similarity index 93%
rename from failure-1.X/src/result_ext.rs
rename to src/result_ext.rs
index c5d51bc..a865832 100644
--- a/failure-1.X/src/result_ext.rs
+++ b/src/result_ext.rs
@@ -71,9 +71,6 @@ pub trait ResultExt<T, E> {
     /// # #[cfg(all(feature = "std", feature = "derive"))]
     /// # #[macro_use] extern crate failure_derive;
     /// #
-    /// # #[cfg(all(feature = "std", feature = "derive"))]
-    /// # #[macro_use] extern crate display_derive;
-    /// #
     /// # fn main() {
     /// #    tests::run_test();
     /// # }
@@ -84,8 +81,8 @@ pub trait ResultExt<T, E> {
     /// #
     /// # use failure::{self, ResultExt};
     /// #
-    /// #[derive(Fail, Debug, Display)]
-    /// #[display(fmt = "")]
+    /// #[derive(Fail, Debug)]
+    /// #[fail(display = "")]
     /// struct CustomError;
     /// # 
     /// # pub fn run_test() {
@@ -116,9 +113,6 @@ pub trait ResultExt<T, E> {
     /// # #[cfg(all(feature = "std", feature = "derive"))]
     /// # #[macro_use] extern crate failure_derive;
     /// #
-    /// # #[cfg(all(feature = "std", feature = "derive"))]
-    /// # #[macro_use] extern crate display_derive;
-    /// #
     /// # fn main() {
     /// #    tests::run_test();
     /// # }
@@ -129,8 +123,8 @@ pub trait ResultExt<T, E> {
     /// #
     /// # use failure::{self, ResultExt};
     /// #
-    /// #[derive(Fail, Debug, Display)]
-    /// #[display(fmt = "My custom error message")]
+    /// #[derive(Fail, Debug)]
+    /// #[fail(display = "My custom error message")]
     /// struct CustomError;
     /// #
     /// # pub fn run_test() {
diff --git a/failure-1.X/src/small_error.rs b/src/small_error.rs
similarity index 100%
rename from failure-1.X/src/small_error.rs
rename to src/small_error.rs
diff --git a/failure-1.X/src/sync_failure.rs b/src/sync_failure.rs
similarity index 100%
rename from failure-1.X/src/sync_failure.rs
rename to src/sync_failure.rs


Test patch:
diff --git a/failure-1.X/failure_derive/tests/backtrace.rs b/failure-1.X/failure_derive/tests/backtrace.rs
deleted file mode 100644
index a656e71..0000000
--- a/failure-1.X/failure_derive/tests/backtrace.rs
+++ /dev/null
@@ -1,61 +0,0 @@
-extern crate failure;
-#[macro_use] extern crate failure_derive;
-#[macro_use] extern crate display_derive;
-
-use failure::{Fail, Backtrace};
-
-#[derive(Fail, Debug, Display)]
-#[display(fmt = "Error code: {}", code)]
-struct BacktraceError {
-    backtrace: Backtrace,
-    code: u32,
-}
-
-#[test]
-fn backtrace_error() {
-    let err = BacktraceError { backtrace: Backtrace::new(), code: 7 };
-    let s = format!("{}", err);
-    assert_eq!(&s[..], "Error code: 7");
-    assert!(err.backtrace().is_some());
-}
-
-#[derive(Fail, Debug, Display)]
-#[display(fmt = "An error has occurred.")]
-struct BacktraceTupleError(Backtrace);
-
-#[test]
-fn backtrace_tuple_error() {
-    let err = BacktraceTupleError(Backtrace::new());
-    let s = format!("{}", err);
-    assert_eq!(&s[..], "An error has occurred.");
-    assert!(err.backtrace().is_some());
-}
-
-#[derive(Fail, Debug, Display)]
-enum BacktraceEnumError {
-    #[display(fmt = "Error code: {}", code)]
-    StructVariant {
-        code: i32,
-        backtrace: Backtrace,
-    },
-    #[display(fmt = "Error: {}", _0)]
-    TupleVariant(&'static str, Backtrace),
-    #[display(fmt = "An error has occurred.")]
-    UnitVariant,
-}
-
-#[test]
-fn backtrace_enum_error() {
-    let err = BacktraceEnumError::StructVariant { code: 2, backtrace: Backtrace::new() };
-    let s = format!("{}", err);
-    assert_eq!(&s[..], "Error code: 2");
-    assert!(err.backtrace().is_some());
-    let err = BacktraceEnumError::TupleVariant("foobar", Backtrace::new());
-    let s = format!("{}", err);
-    assert_eq!(&s[..], "Error: foobar");
-    assert!(err.backtrace().is_some());
-    let err = BacktraceEnumError::UnitVariant;
-    let s = format!("{}", err);
-    assert_eq!(&s[..], "An error has occurred.");
-    assert!(err.backtrace().is_none());
-}
diff --git a/failure-1.X/failure_derive/tests/no_derive_display.rs b/failure-1.X/failure_derive/tests/no_derive_display.rs
deleted file mode 100644
index 93ca7bb..0000000
--- a/failure-1.X/failure_derive/tests/no_derive_display.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-extern crate failure;
-#[macro_use] extern crate failure_derive;
-
-use std::fmt::{self, Display};
-use failure::Fail;
-
-#[derive(Debug, Fail)]
-struct Foo;
-
-impl Display for Foo {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
-        f.write_str("An error occurred.")
-    }
-}
-
-#[test]
-fn handwritten_display() {
-    assert!(Foo.cause().is_none());
-    assert_eq!(&format!("{}", Foo)[..], "An error occurred.");
-}
diff --git a/failure-1.X/failure_derive/tests/tests.rs b/failure-1.X/failure_derive/tests/tests.rs
deleted file mode 100644
index 465be1e..0000000
--- a/failure-1.X/failure_derive/tests/tests.rs
+++ /dev/null
@@ -1,57 +0,0 @@
-extern crate failure;
-#[macro_use] extern crate failure_derive;
-#[macro_use] extern crate display_derive;
-
-#[derive(Fail, Debug, Display)]
-#[display(fmt = "An error has occurred.")]
-struct UnitError;
-
-#[test]
-fn unit_struct() {
-    let s = format!("{}", UnitError);
-    assert_eq!(&s[..], "An error has occurred.");
-}
-
-#[derive(Fail, Debug, Display)]
-#[display(fmt = "Error code: {}", code)]
-struct RecordError {
-    code: u32,
-}
-
-#[test]
-fn record_struct() {
-    let s = format!("{}", RecordError { code: 0 });
-    assert_eq!(&s[..], "Error code: 0");
-}
-
-#[derive(Fail, Debug, Display)]
-#[display(fmt = "Error code: {}", _0)]
-struct TupleError(i32);
-
-#[test]
-fn tuple_struct() {
-    let s = format!("{}", TupleError(2));
-    assert_eq!(&s[..], "Error code: 2");
-}
-
-#[derive(Fail, Debug, Display)]
-enum EnumError {
-    #[display(fmt = "Error code: {}", code)]
-    StructVariant {
-        code: i32,
-    },
-    #[display(fmt = "Error: {}", _0)]
-    TupleVariant(&'static str),
-    #[display(fmt = "An error has occurred.")]
-    UnitVariant,
-}
-
-#[test]
-fn enum_error() {
-    let s = format!("{}", EnumError::StructVariant { code: 2 });
-    assert_eq!(&s[..], "Error code: 2");
-    let s = format!("{}", EnumError::TupleVariant("foobar"));
-    assert_eq!(&s[..], "Error: foobar");
-    let s = format!("{}", EnumError::UnitVariant);
-    assert_eq!(&s[..], "An error has occurred.");
-}
diff --git a/failure-1.X/failure_derive/tests/wraps.rs b/failure-1.X/failure_derive/tests/wraps.rs
deleted file mode 100644
index 7f08058..0000000
--- a/failure-1.X/failure_derive/tests/wraps.rs
+++ /dev/null
@@ -1,70 +0,0 @@
-extern crate failure;
-#[macro_use] extern crate failure_derive;
-#[macro_use] extern crate display_derive;
-
-use std::io;
-use std::fmt;
-
-use failure::{Backtrace, Fail};
-
-#[derive(Fail, Debug, Display)]
-#[display(fmt = "An error has occurred: {}", inner)]
-struct WrapError {
-    #[fail(cause)] inner: io::Error,
-}
-
-#[test]
-fn wrap_error() {
-    let inner = io::Error::from_raw_os_error(98);
-    let err = WrapError { inner };
-    assert!(err.cause().and_then(|err| err.downcast_ref::<io::Error>()).is_some());
-}
-
-#[derive(Fail, Debug, Display)]
-#[display(fmt = "An error has occurred: {}", _0)]
-struct WrapTupleError(#[fail(cause)] io::Error);
-
-#[test]
-fn wrap_tuple_error() {
-    let io_error = io::Error::from_raw_os_error(98);
-    let err: WrapTupleError = WrapTupleError(io_error);
-    assert!(err.cause().and_then(|err| err.downcast_ref::<io::Error>()).is_some());
-}
-
-#[derive(Fail, Debug, Display)]
-#[display(fmt = "An error has occurred: {}", inner)]
-struct WrapBacktraceError {
-    #[fail(cause)] inner: io::Error,
-    backtrace: Backtrace,
-}
-
-#[test]
-fn wrap_backtrace_error() {
-    let inner = io::Error::from_raw_os_error(98);
-    let err: WrapBacktraceError = WrapBacktraceError { inner, backtrace: Backtrace::new() };
-    assert!(err.cause().and_then(|err| err.downcast_ref::<io::Error>()).is_some());
-    assert!(err.backtrace().is_some());
-}
-
-#[derive(Fail, Debug, Display)]
-enum WrapEnumError {
-    #[display(fmt = "An error has occurred: {}", _0)]
-    Io(#[fail(cause)] io::Error),
-    #[display(fmt = "An error has occurred: {}", inner)]
-    Fmt {
-        #[fail(cause)] inner: fmt::Error,
-        backtrace: Backtrace,
-    },
-}
-
-#[test]
-fn wrap_enum_error() {
-    let io_error = io::Error::from_raw_os_error(98);
-    let err: WrapEnumError = WrapEnumError::Io(io_error);
-    assert!(err.cause().and_then(|err| err.downcast_ref::<io::Error>()).is_some());
-    assert!(err.backtrace().is_none());
-    let fmt_error = fmt::Error::default();
-    let err: WrapEnumError = WrapEnumError::Fmt { inner: fmt_error, backtrace: Backtrace::new() };
-    assert!(err.cause().and_then(|err| err.downcast_ref::<fmt::Error>()).is_some());
-    assert!(err.backtrace().is_some());
-}
diff --git a/failure-0.1.X/failure_derive/tests/backtrace.rs b/failure_derive/tests/backtrace.rs
similarity index 100%
rename from failure-0.1.X/failure_derive/tests/backtrace.rs
rename to failure_derive/tests/backtrace.rs
diff --git a/failure-0.1.X/failure_derive/tests/external_display_derive.rs b/failure_derive/tests/external_display_derive.rs
similarity index 100%
rename from failure-0.1.X/failure_derive/tests/external_display_derive.rs
rename to failure_derive/tests/external_display_derive.rs
diff --git a/failure-0.1.X/failure_derive/tests/no_derive_display.rs b/failure_derive/tests/no_derive_display.rs
similarity index 100%
rename from failure-0.1.X/failure_derive/tests/no_derive_display.rs
rename to failure_derive/tests/no_derive_display.rs
diff --git a/failure-0.1.X/failure_derive/tests/tests.rs b/failure_derive/tests/tests.rs
similarity index 100%
rename from failure-0.1.X/failure_derive/tests/tests.rs
rename to failure_derive/tests/tests.rs
diff --git a/failure-0.1.X/failure_derive/tests/wraps.rs b/failure_derive/tests/wraps.rs
similarity index 100%
rename from failure-0.1.X/failure_derive/tests/wraps.rs
rename to failure_derive/tests/wraps.rs