mirror of
https://github.com/eyre-rs/eyre.git
synced 2025-09-28 05:21:34 +00:00
Simplify downcast_ref and downcast_mut
This commit is contained in:
parent
83f63a6544
commit
8895b006a7
@ -290,7 +290,7 @@ impl Error {
|
||||
E: Display + Debug + Send + Sync + 'static,
|
||||
{
|
||||
if self.is::<E>() {
|
||||
unsafe { Some(&*(self.inner.error() as *const dyn StdError as *const E)) }
|
||||
Some(unsafe { &*(&self.inner.error as *const () as *const E) })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
@ -302,7 +302,7 @@ impl Error {
|
||||
E: Display + Debug + Send + Sync + 'static,
|
||||
{
|
||||
if self.is::<E>() {
|
||||
unsafe { Some(&mut *(self.inner.error_mut() as *mut dyn StdError as *mut E)) }
|
||||
Some(unsafe { &mut *(&mut self.inner.error as *mut () as *mut E) })
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user