Skip to content
This repository has been archived by the owner on Aug 16, 2021. It is now read-only.

Commit

Permalink
Reformat for latest rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Dec 28, 2018
1 parent 8f8f92f commit 0f89723
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 38 deletions.
3 changes: 2 additions & 1 deletion failure_derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ fn fail_derive(s: synstructure::Structure) -> TokenStream {
(quote! {
#fail
#display
}).into()
})
.into()
}

fn display_body(s: &synstructure::Structure) -> Option<quote::__rt::TokenStream> {
Expand Down
45 changes: 20 additions & 25 deletions failure_derive/tests/wraps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ struct WrapError {
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()
);
assert!(err
.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some());
}

#[derive(Fail, Debug)]
Expand All @@ -33,11 +32,10 @@ struct WrapTupleError(#[fail(cause)] io::Error);
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()
);
assert!(err
.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some());
}

#[derive(Fail, Debug)]
Expand All @@ -55,11 +53,10 @@ fn wrap_backtrace_error() {
inner,
backtrace: Backtrace::new(),
};
assert!(
err.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some()
);
assert!(err
.cause()
.and_then(|err| err.downcast_ref::<io::Error>())
.is_some());
assert!(err.backtrace().is_some());
}

Expand All @@ -79,21 +76,19 @@ enum WrapEnumError {
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
.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
.cause()
.and_then(|err| err.downcast_ref::<fmt::Error>())
.is_some());
assert!(err.backtrace().is_some());
}
15 changes: 3 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![deny(missing_docs)]
#![deny(warnings)]
#![cfg_attr(
feature = "small-error",
feature(extern_types, allocator_api)
)]
#![cfg_attr(feature = "small-error", feature(extern_types, allocator_api))]

macro_rules! with_std { ($($i:item)*) => ($(#[cfg(feature = "std")]$i)*) }
macro_rules! without_std { ($($i:item)*) => ($(#[cfg(not(feature = "std"))]$i)*) }
Expand Down Expand Up @@ -166,10 +163,7 @@ pub trait Fail: Display + Debug + Send + Sync + 'static {
}

#[doc(hidden)]
#[deprecated(
since = "0.1.2",
note = "please use the 'iter_chain()' method instead"
)]
#[deprecated(since = "0.1.2", note = "please use the 'iter_chain()' method instead")]
fn causes(&self) -> Causes
where
Self: Sized,
Expand Down Expand Up @@ -259,10 +253,7 @@ impl Fail {
}

/// Deprecated alias to `iter_chain`.
#[deprecated(
since = "0.1.2",
note = "please use the 'iter_chain()' method instead"
)]
#[deprecated(since = "0.1.2", note = "please use the 'iter_chain()' method instead")]
pub fn causes(&self) -> Causes {
Causes { fail: Some(self) }
}
Expand Down

0 comments on commit 0f89723

Please sign in to comment.