0
0
Fork 0
mirror of https://github.com/denoland/rusty_v8.git synced 2024-12-26 00:59:28 -05:00

Avoid warnings by adding explicit dyns in a few spots (#677)

This commit is contained in:
Nicholas Sielicki 2021-04-29 15:12:54 -05:00 committed by GitHub
parent 26427db2a8
commit 4b7f57081a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -415,14 +415,14 @@ impl Isolate {
/// Get a reference to embedder data added with `set_slot()`. /// Get a reference to embedder data added with `set_slot()`.
pub fn get_slot<T: 'static>(&self) -> Option<&T> { pub fn get_slot<T: 'static>(&self) -> Option<&T> {
let b = self.get_annex().slots.get(&TypeId::of::<T>())?; let b = self.get_annex().slots.get(&TypeId::of::<T>())?;
let r = Any::downcast_ref::<T>(&**b).unwrap(); let r = <dyn Any>::downcast_ref::<T>(&**b).unwrap();
Some(r) Some(r)
} }
/// Get a mutable reference to embedder data added with `set_slot()`. /// Get a mutable reference to embedder data added with `set_slot()`.
pub fn get_slot_mut<T: 'static>(&mut self) -> Option<&mut T> { pub fn get_slot_mut<T: 'static>(&mut self) -> Option<&mut T> {
let b = self.get_annex_mut().slots.get_mut(&TypeId::of::<T>())?; let b = self.get_annex_mut().slots.get_mut(&TypeId::of::<T>())?;
let r = Any::downcast_mut::<T>(&mut **b).unwrap(); let r = <dyn Any>::downcast_mut::<T>(&mut **b).unwrap();
Some(r) Some(r)
} }

View file

@ -408,7 +408,7 @@ impl<T: ?Sized + 'static> Allocation<T> {
value: Abstract, value: Abstract,
wrap: fn(Concrete) -> Self, wrap: fn(Concrete) -> Self,
) -> Result<Self, Abstract> { ) -> Result<Self, Abstract> {
if Any::is::<Concrete>(&value) { if <dyn Any>::is::<Concrete>(&value) {
Ok(unsafe { Self::transmute_wrap(value, wrap) }) Ok(unsafe { Self::transmute_wrap(value, wrap) })
} else { } else {
Err(value) Err(value)