mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-28 13:31:29 +00:00
Format with rustfmt 2019-09-08
This commit is contained in:
parent
4118197eac
commit
a727067a7d
12
src/error.rs
12
src/error.rs
@ -233,7 +233,9 @@ impl Error {
|
||||
if self.is::<E>() {
|
||||
let outer = ManuallyDrop::new(self);
|
||||
unsafe {
|
||||
let error = ptr::read(outer.inner.error() as *const (dyn StdError + Send + Sync) as *const E);
|
||||
let error = ptr::read(
|
||||
outer.inner.error() as *const (dyn StdError + Send + Sync) as *const E
|
||||
);
|
||||
let inner = ptr::read(&outer.inner);
|
||||
let erased = ManuallyDrop::into_inner(inner);
|
||||
(erased.vtable.object_drop_front)(erased);
|
||||
@ -285,7 +287,9 @@ impl Error {
|
||||
E: Display + Debug + Send + Sync + 'static,
|
||||
{
|
||||
if self.is::<E>() {
|
||||
Some(unsafe { &*(self.inner.error() as *const (dyn StdError + Send + Sync) as *const E) })
|
||||
Some(unsafe {
|
||||
&*(self.inner.error() as *const (dyn StdError + Send + Sync) as *const E)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -297,7 +301,9 @@ impl Error {
|
||||
E: Display + Debug + Send + Sync + 'static,
|
||||
{
|
||||
if self.is::<E>() {
|
||||
Some(unsafe { &mut *(self.inner.error_mut() as *mut (dyn StdError + Send + Sync) as *mut E) })
|
||||
Some(unsafe {
|
||||
&mut *(self.inner.error_mut() as *mut (dyn StdError + Send + Sync) as *mut E)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -94,5 +94,8 @@ fn test_large_alignment() {
|
||||
impl StdError for LargeAlignedError {}
|
||||
|
||||
let error = Error::new(LargeAlignedError("oh no!"));
|
||||
assert_eq!("oh no!", error.downcast_ref::<LargeAlignedError>().unwrap().0);
|
||||
assert_eq!(
|
||||
"oh no!",
|
||||
error.downcast_ref::<LargeAlignedError>().unwrap().0
|
||||
);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user