diff --git a/examples/src/boids/mod.rs b/examples/src/boids/mod.rs index f7875ed7643..dba1c126720 100644 --- a/examples/src/boids/mod.rs +++ b/examples/src/boids/mod.rs @@ -2,7 +2,7 @@ // adapted from https://github.com/austinEng/webgpu-samples/blob/master/src/examples/computeBoids.ts use nanorand::{Rng, WyRand}; -use std::{borrow::Cow, mem::size_of}; +use std::borrow::Cow; use wgpu::util::DeviceExt; // number of boid particles to simulate diff --git a/examples/src/cube/mod.rs b/examples/src/cube/mod.rs index 00e2ffcfc33..35aa6edf834 100644 --- a/examples/src/cube/mod.rs +++ b/examples/src/cube/mod.rs @@ -1,5 +1,5 @@ use bytemuck::{Pod, Zeroable}; -use std::{borrow::Cow, f32::consts, mem::size_of}; +use std::{borrow::Cow, f32::consts}; use wgpu::util::DeviceExt; #[repr(C)] diff --git a/examples/src/mipmap/mod.rs b/examples/src/mipmap/mod.rs index a3f7833b4c8..78b74829acd 100644 --- a/examples/src/mipmap/mod.rs +++ b/examples/src/mipmap/mod.rs @@ -1,5 +1,5 @@ use bytemuck::{Pod, Zeroable}; -use std::{borrow::Cow, f32::consts, mem::size_of}; +use std::{borrow::Cow, f32::consts}; use wgpu::util::DeviceExt; const TEXTURE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8UnormSrgb; diff --git a/examples/src/repeated_compute/mod.rs b/examples/src/repeated_compute/mod.rs index 5dac9ce7c2e..acf88a66368 100644 --- a/examples/src/repeated_compute/mod.rs +++ b/examples/src/repeated_compute/mod.rs @@ -5,8 +5,6 @@ //! hello-compute example does not such as mapping buffers //! and why use the async channels. -use std::mem::size_of_val; - const OVERFLOW: u32 = 0xffffffff; async fn run() { diff --git a/examples/src/shadow/mod.rs b/examples/src/shadow/mod.rs index 5e3511ed812..d6c6b4ff22b 100644 --- a/examples/src/shadow/mod.rs +++ b/examples/src/shadow/mod.rs @@ -1,4 +1,4 @@ -use std::{borrow::Cow, f32::consts, iter, mem::size_of, ops::Range, sync::Arc}; +use std::{borrow::Cow, f32::consts, iter, ops::Range, sync::Arc}; use bytemuck::{Pod, Zeroable}; use wgpu::util::{align_to, DeviceExt}; diff --git a/examples/src/stencil_triangles/mod.rs b/examples/src/stencil_triangles/mod.rs index bb433af11ca..5867a3b907c 100644 --- a/examples/src/stencil_triangles/mod.rs +++ b/examples/src/stencil_triangles/mod.rs @@ -1,6 +1,5 @@ use bytemuck::{Pod, Zeroable}; use std::borrow::Cow; -use std::mem::size_of; use wgpu::util::DeviceExt; #[repr(C)] diff --git a/examples/src/water/mod.rs b/examples/src/water/mod.rs index 7f766034a43..ec605a7b0cd 100644 --- a/examples/src/water/mod.rs +++ b/examples/src/water/mod.rs @@ -3,7 +3,7 @@ mod point_gen; use bytemuck::{Pod, Zeroable}; use glam::Vec3; use nanorand::{Rng, WyRand}; -use std::{borrow::Cow, f32::consts, iter, mem::size_of}; +use std::{borrow::Cow, f32::consts, iter}; use wgpu::util::DeviceExt; /// diff --git a/naga/src/back/msl/mod.rs b/naga/src/back/msl/mod.rs index 626475debcd..bc4a24614d2 100644 --- a/naga/src/back/msl/mod.rs +++ b/naga/src/back/msl/mod.rs @@ -668,6 +668,6 @@ pub fn write_string( #[test] fn test_error_size() { - use std::mem::size_of; + use size_of; assert_eq!(size_of::(), 32); } diff --git a/wgpu-core/src/command/bundle.rs b/wgpu-core/src/command/bundle.rs index a7a43e1e2e4..1cd9a0bcf7f 100644 --- a/wgpu-core/src/command/bundle.rs +++ b/wgpu-core/src/command/bundle.rs @@ -100,7 +100,7 @@ use crate::{ }; use arrayvec::ArrayVec; -use std::{borrow::Cow, mem::size_of, num::NonZeroU32, ops::Range, sync::Arc}; +use std::{borrow::Cow, num::NonZeroU32, ops::Range, sync::Arc}; use thiserror::Error; use super::{ diff --git a/wgpu-core/src/command/compute.rs b/wgpu-core/src/command/compute.rs index eb929740c80..bf8c66cf6df 100644 --- a/wgpu-core/src/command/compute.rs +++ b/wgpu-core/src/command/compute.rs @@ -29,7 +29,7 @@ use thiserror::Error; use wgt::{BufferAddress, DynamicOffset}; use std::sync::Arc; -use std::{fmt, mem::size_of, str}; +use std::{fmt, str}; use super::{bind::BinderError, memory_init::CommandBufferTextureMemoryActions}; diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index e4d93b042eb..0017b2b4fc2 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -45,7 +45,7 @@ use serde::Deserialize; use serde::Serialize; use std::sync::Arc; -use std::{borrow::Cow, fmt, iter, mem::size_of, num::NonZeroU32, ops::Range, str}; +use std::{borrow::Cow, fmt, iter, num::NonZeroU32, ops::Range, str}; use super::render_command::ArcRenderCommand; use super::{ diff --git a/wgpu-core/src/pipeline_cache.rs b/wgpu-core/src/pipeline_cache.rs index e506d2cd5b5..057223fb573 100644 --- a/wgpu-core/src/pipeline_cache.rs +++ b/wgpu-core/src/pipeline_cache.rs @@ -1,5 +1,3 @@ -use std::mem::size_of; - use thiserror::Error; use wgt::AdapterInfo; diff --git a/wgpu-core/src/registry.rs b/wgpu-core/src/registry.rs index 3abd4b6eb99..3cb451951c3 100644 --- a/wgpu-core/src/registry.rs +++ b/wgpu-core/src/registry.rs @@ -1,4 +1,4 @@ -use std::{mem::size_of, sync::Arc}; +use std::sync::Arc; use crate::{ id::Id, diff --git a/wgpu-hal/examples/halmark/main.rs b/wgpu-hal/examples/halmark/main.rs index 8ab7f1cb470..8f92f8137b2 100644 --- a/wgpu-hal/examples/halmark/main.rs +++ b/wgpu-hal/examples/halmark/main.rs @@ -14,9 +14,7 @@ use winit::{ use std::{ borrow::{Borrow, Cow}, - iter, - mem::size_of, - ptr, + iter, ptr, time::Instant, }; diff --git a/wgpu-hal/examples/ray-traced-triangle/main.rs b/wgpu-hal/examples/ray-traced-triangle/main.rs index 816827b5ae3..620bebc5648 100644 --- a/wgpu-hal/examples/ray-traced-triangle/main.rs +++ b/wgpu-hal/examples/ray-traced-triangle/main.rs @@ -8,9 +8,7 @@ use raw_window_handle::{HasDisplayHandle, HasWindowHandle}; use glam::{Affine3A, Mat4, Vec3}; use std::{ borrow::{Borrow, Cow}, - iter, - mem::size_of, - ptr, + iter, ptr, time::Instant, }; use winit::window::WindowButtons; diff --git a/wgpu-hal/src/dx12/mod.rs b/wgpu-hal/src/dx12/mod.rs index be0f6960ba7..8c3582f90d7 100644 --- a/wgpu-hal/src/dx12/mod.rs +++ b/wgpu-hal/src/dx12/mod.rs @@ -622,7 +622,6 @@ struct PassState { #[test] fn test_dirty_mask() { - use std::mem::size_of; assert_eq!(MAX_ROOT_ELEMENTS, size_of::() * 8); } diff --git a/wgpu-hal/src/gles/command.rs b/wgpu-hal/src/gles/command.rs index 2df3c1a991b..7d8ce413754 100644 --- a/wgpu-hal/src/gles/command.rs +++ b/wgpu-hal/src/gles/command.rs @@ -1,9 +1,6 @@ use super::{conv, Command as C}; use arrayvec::ArrayVec; -use std::{ - mem::{self, size_of, size_of_val}, - ops::Range, -}; +use std::{mem, ops::Range}; #[derive(Clone, Copy, Debug, Default)] struct TextureSlotDesc { diff --git a/wgpu-hal/src/gles/queue.rs b/wgpu-hal/src/gles/queue.rs index 39315f72b7d..6ea3bd0b87e 100644 --- a/wgpu-hal/src/gles/queue.rs +++ b/wgpu-hal/src/gles/queue.rs @@ -2,7 +2,6 @@ use super::{conv::is_layered_target, Command as C, PrivateCapabilities}; use arrayvec::ArrayVec; use glow::HasContext; use std::{ - mem::size_of, slice, sync::{atomic::Ordering, Arc}, }; diff --git a/wgpu-hal/src/metal/command.rs b/wgpu-hal/src/metal/command.rs index 069013570f0..98c395b8708 100644 --- a/wgpu-hal/src/metal/command.rs +++ b/wgpu-hal/src/metal/command.rs @@ -1,6 +1,6 @@ use super::{conv, AsNative, TimestampQuerySupport}; use crate::CommandEncoder as _; -use std::{borrow::Cow, mem::size_of, ops::Range}; +use std::{borrow::Cow, ops::Range}; // has to match `Temp::binding_sizes` const WORD_SIZE: usize = 4; diff --git a/wgpu-hal/src/vulkan/command.rs b/wgpu-hal/src/vulkan/command.rs index 8bd749cd3b0..0eb9a7abc77 100644 --- a/wgpu-hal/src/vulkan/command.rs +++ b/wgpu-hal/src/vulkan/command.rs @@ -3,11 +3,7 @@ use super::conv; use arrayvec::ArrayVec; use ash::vk; -use std::{ - mem::{self, size_of}, - ops::Range, - slice, -}; +use std::{mem, ops::Range, slice}; const ALLOCATION_GRANULARITY: u32 = 16; const DST_IMAGE_LAYOUT: vk::ImageLayout = vk::ImageLayout::TRANSFER_DST_OPTIMAL; diff --git a/wgpu/src/util/mod.rs b/wgpu/src/util/mod.rs index 11148179b4a..339b08dddc2 100644 --- a/wgpu/src/util/mod.rs +++ b/wgpu/src/util/mod.rs @@ -9,11 +9,7 @@ mod encoder; mod init; use std::sync::Arc; -use std::{ - borrow::Cow, - mem::{align_of, size_of}, - ptr::copy_nonoverlapping, -}; +use std::{borrow::Cow, ptr::copy_nonoverlapping}; pub use belt::StagingBelt; pub use device::{BufferInitDescriptor, DeviceExt, TextureDataOrder};