From 4816a2d1bd72e0976c306181695106497ea2ad85 Mon Sep 17 00:00:00 2001 From: Erich Gubler Date: Thu, 4 Jul 2024 21:33:21 -0600 Subject: [PATCH] refactor!: suppress `dead_code` in `wgpu::util::DownloadBuffer` (#5917) --- wgpu/src/util/mod.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/wgpu/src/util/mod.rs b/wgpu/src/util/mod.rs index d83263bcf..f52b82a9c 100644 --- a/wgpu/src/util/mod.rs +++ b/wgpu/src/util/mod.rs @@ -82,10 +82,10 @@ pub fn make_spirv_raw(data: &[u8]) -> Cow<'_, [u32]> { } /// CPU accessible buffer used to download data back from the GPU. -pub struct DownloadBuffer( - Arc, - Box, -); +pub struct DownloadBuffer { + _gpu_buffer: Arc, + mapped_range: Box, +} impl DownloadBuffer { /// Asynchronously read the contents of a buffer. @@ -129,7 +129,10 @@ impl DownloadBuffer { download.data.as_ref(), 0..size, ); - callback(Ok(Self(download, mapped_range))); + callback(Ok(Self { + _gpu_buffer: download, + mapped_range, + })); }); } } @@ -137,7 +140,7 @@ impl DownloadBuffer { impl std::ops::Deref for DownloadBuffer { type Target = [u8]; fn deref(&self) -> &[u8] { - self.1.slice() + self.mapped_range.slice() } }