diff --git a/wgpu/src/api/adapter.rs b/wgpu/src/api/adapter.rs
index d4250a6c69..034ea37abe 100644
--- a/wgpu/src/api/adapter.rs
+++ b/wgpu/src/api/adapter.rs
@@ -118,7 +118,7 @@ impl Adapter {
// Therefore, unwrap is fine here since only WgpuCoreContext based adapters have the ability to create hal devices.
.unwrap()
.create_device_from_hal(
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
hal_device,
desc,
trace_path,
@@ -169,7 +169,7 @@ impl Adapter {
{
unsafe {
ctx.adapter_as_hal::(
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
hal_adapter_callback,
)
}
diff --git a/wgpu/src/api/buffer.rs b/wgpu/src/api/buffer.rs
index d5687a78dc..9d490616d3 100644
--- a/wgpu/src/api/buffer.rs
+++ b/wgpu/src/api/buffer.rs
@@ -217,7 +217,7 @@ impl Buffer {
{
unsafe {
ctx.buffer_as_hal::(
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
hal_buffer_callback,
)
}
diff --git a/wgpu/src/api/command_encoder.rs b/wgpu/src/api/command_encoder.rs
index 949efc809b..a45564b45d 100644
--- a/wgpu/src/api/command_encoder.rs
+++ b/wgpu/src/api/command_encoder.rs
@@ -310,7 +310,7 @@ impl CommandEncoder {
.downcast_ref::()
.map(|ctx| unsafe {
ctx.command_encoder_as_hal_mut::(
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
hal_command_encoder_callback,
)
})
diff --git a/wgpu/src/api/device.rs b/wgpu/src/api/device.rs
index 8d1705ab4f..e2a9f7f953 100644
--- a/wgpu/src/api/device.rs
+++ b/wgpu/src/api/device.rs
@@ -284,7 +284,7 @@ impl Device {
.unwrap()
.create_texture_from_hal::(
hal_texture,
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
desc,
)
};
@@ -328,7 +328,7 @@ impl Device {
.unwrap()
.create_buffer_from_hal::(
hal_buffer,
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
desc,
)
};
@@ -441,7 +441,7 @@ impl Device {
.downcast_ref::()
.map(|ctx| unsafe {
ctx.device_as_hal::(
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
hal_device_callback,
)
})
diff --git a/wgpu/src/api/surface.rs b/wgpu/src/api/surface.rs
index 2b5252a216..ecb0d96938 100644
--- a/wgpu/src/api/surface.rs
+++ b/wgpu/src/api/surface.rs
@@ -168,7 +168,7 @@ impl Surface<'_> {
.downcast_ref::()
.map(|ctx| unsafe {
ctx.surface_as_hal::(
- crate::context::downcast_ref(&self.surface_data),
+ crate::context::downcast_ref(self.surface_data.as_ref()),
hal_surface_callback,
)
})
diff --git a/wgpu/src/api/texture.rs b/wgpu/src/api/texture.rs
index 9f4f6ad4cf..5d01ecdea3 100644
--- a/wgpu/src/api/texture.rs
+++ b/wgpu/src/api/texture.rs
@@ -39,7 +39,7 @@ impl Texture {
{
unsafe {
ctx.texture_as_hal::(
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
hal_texture_callback,
)
}
diff --git a/wgpu/src/api/texture_view.rs b/wgpu/src/api/texture_view.rs
index bba82c745b..862fe21999 100644
--- a/wgpu/src/api/texture_view.rs
+++ b/wgpu/src/api/texture_view.rs
@@ -37,7 +37,7 @@ impl TextureView {
{
unsafe {
ctx.texture_view_as_hal::(
- crate::context::downcast_ref(&self.data),
+ crate::context::downcast_ref(self.data.as_ref()),
hal_texture_view_callback,
)
}