Skip to content
Myr

Simplify downcast_ref and downcast_mut

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Tolnay · committed by David Tolnay · parent 83f63a6 · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:src/error.rs+2 added-2 removed
288 unmodified lines
289 where290 E: Display + Debug + Send + Sync + 'static,291 {292 if self.is::<E>() {293 unsafe { Some(&*(self.inner.error() as *const dyn StdError as *const E)) }293 Some(unsafe { &*(&self.inner.error as *const () as *const E) })294 } else {295 None296 }297 }
3 unmodified lines
301 where302 E: Display + Debug + Send + Sync + 'static,303 {304 if self.is::<E>() {305 unsafe { Some(&mut *(self.inner.error_mut() as *mut dyn StdError as *mut E)) }305 Some(unsafe { &mut *(&mut self.inner.error as *mut () as *mut E) })306 } else {307 None308 }309 }
260 unmodified lines