chore: remove std::mem::* imports now unnecessary with Rust 1.80

`std::mem::{size,align}_of{,_val}` was added to `std::prelude` in Rust
1.80; see
[`rust`#123168](https://github.com/rust-lang/rust/pull/123168/).
This commit is contained in:
Erich Gubler 2024-08-12 11:43:07 +01:00
parent f9635e73cf
commit 8c9dd13097
50 changed files with 30 additions and 83 deletions

View File

@ -2,7 +2,6 @@
// adapted from https://github.com/austinEng/webgpu-samples/blob/master/src/examples/computeBoids.ts
use nanorand::{Rng, WyRand};
use std::mem::size_of;
use wgpu::util::DeviceExt;
// number of boid particles to simulate

View File

@ -1,6 +1,6 @@
use bytemuck::{Pod, Zeroable};
use nanorand::{Rng, WyRand};
use std::{borrow::Cow, mem::size_of};
use std::borrow::Cow;
use wgpu::util::DeviceExt;
use winit::{
event::{ElementState, KeyEvent},

View File

@ -1,5 +1,5 @@
use bytemuck::{Pod, Zeroable};
use std::{f32::consts, mem::size_of};
use std::f32::consts;
use wgpu::util::DeviceExt;
#[repr(C)]

View File

@ -1,4 +1,4 @@
use std::{mem::size_of_val, str::FromStr};
use std::str::FromStr;
use wgpu::util::DeviceExt;
// Indicates a u32 overflow in an intermediate Collatz value

View File

@ -1,5 +1,3 @@
use std::mem::size_of_val;
const ARR_SIZE: usize = 128;
struct ExecuteResults {

View File

@ -7,8 +7,6 @@
//!
//! Only parts specific to this example will be commented.
use std::mem::size_of_val;
use wgpu::util::DeviceExt;
async fn run() {

View File

@ -1,5 +1,5 @@
use bytemuck::{Pod, Zeroable};
use std::{f32::consts, mem::size_of};
use std::f32::consts;
use wgpu::util::DeviceExt;
const TEXTURE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8UnormSrgb;

View File

@ -7,7 +7,7 @@
//! * Set the primitive_topology to PrimitiveTopology::LineList.
//! * Vertices and Indices describe the two points that make up a line.
use std::{iter, mem::size_of};
use std::iter;
use bytemuck::{Pod, Zeroable};
use wgpu::util::DeviceExt;

View File

@ -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() {

View File

@ -1,4 +1,4 @@
use std::{f32::consts, iter, mem::size_of, ops::Range, sync::Arc};
use std::{f32::consts, iter, ops::Range, sync::Arc};
use bytemuck::{Pod, Zeroable};
use wgpu::util::{align_to, DeviceExt};

View File

@ -1,5 +1,5 @@
use bytemuck::{Pod, Zeroable};
use std::{f32::consts, mem::size_of};
use std::f32::consts;
use wgpu::{util::DeviceExt, AstcBlock, AstcChannel};
const IMAGE_SIZE: u32 = 256;

View File

@ -1,5 +1,4 @@
use bytemuck::{Pod, Zeroable};
use std::mem::size_of;
use wgpu::util::DeviceExt;
#[repr(C)]

View File

@ -1,5 +1,4 @@
use bytemuck::{Pod, Zeroable};
use std::mem::size_of;
use wgpu::util::DeviceExt;
#[repr(C)]

View File

@ -14,8 +14,6 @@
//! A lot of things aren't explained here via comments. See hello-compute and
//! repeated-compute for code that is more thoroughly commented.
use std::mem::size_of_val;
#[cfg(not(target_arch = "wasm32"))]
use crate::utils::output_image_native;
#[cfg(target_arch = "wasm32")]

View File

@ -1,8 +1,5 @@
use bytemuck::{Pod, Zeroable};
use std::{
mem::size_of,
num::{NonZeroU32, NonZeroU64},
};
use std::num::{NonZeroU32, NonZeroU64};
use wgpu::util::DeviceExt;
#[repr(C)]

View File

@ -17,8 +17,6 @@
//! The period, i.e. the unit of time, of the timestamps in wgpu is undetermined and needs to be queried with `wgpu::Queue::get_timestamp_period`
//! in order to get comparable results.
use std::mem::size_of;
use wgpu::util::DeviceExt;
struct Queries {

View File

@ -16,7 +16,7 @@
//! The usage of the uniform buffer within the shader itself is pretty self-explanatory given
//! some understanding of WGSL.
use std::{mem::size_of, sync::Arc};
use std::sync::Arc;
// We won't bring StorageBuffer into scope as that might be too easy to confuse
// with actual GPU-allocated WGPU storage buffers.
use encase::ShaderType;

View File

@ -3,7 +3,7 @@ mod point_gen;
use bytemuck::{Pod, Zeroable};
use glam::Vec3;
use nanorand::{Rng, WyRand};
use std::{f32::consts, iter, mem::size_of};
use std::{f32::consts, iter};
use wgpu::util::DeviceExt;
///

View File

@ -668,6 +668,5 @@ pub fn write_string(
#[test]
fn test_error_size() {
use std::mem::size_of;
assert_eq!(size_of::<Error>(), 32);
}

View File

@ -17,9 +17,6 @@ use std::ops::Range;
use termcolor::{ColorChoice, NoColor, StandardStream};
use thiserror::Error;
#[cfg(test)]
use std::mem::size_of;
#[derive(Clone, Debug)]
pub struct ParseError {
message: String,

View File

@ -140,6 +140,5 @@ impl<'de> serde::Deserialize<'de> for NonMaxU32 {
#[test]
fn size() {
use core::mem::size_of;
assert_eq!(size_of::<Option<NonMaxU32>>(), size_of::<u32>());
}

View File

@ -918,6 +918,5 @@ impl<'a> ResolveContext<'a> {
#[test]
fn test_error_size() {
use std::mem::size_of;
assert_eq!(size_of::<ResolveError>(), 32);
}

View File

@ -14,7 +14,6 @@ use player::GlobalPlay;
use std::{
fs::{read_to_string, File},
io::{Read, Seek, SeekFrom},
mem::size_of,
path::{Path, PathBuf},
slice,
};

View File

@ -1,7 +1,7 @@
//! Tests that compute passes take ownership of resources that are associated with.
//! I.e. once a resource is passed in to a compute pass, it can be dropped.
use std::{mem::size_of, num::NonZeroU64};
use std::num::NonZeroU64;
use wgpu::util::DeviceExt as _;
use wgpu_test::{gpu_test, valid, GpuTestConfiguration, TestParameters, TestingContext};

View File

@ -1,4 +1,3 @@
use std::mem::size_of;
use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration, TestParameters};
#[gpu_test]

View File

@ -9,7 +9,7 @@
//! * rpass.multi_draw_indirect_count
//! * rpass.multi_draw_indexed_indirect_count
//!
use std::{mem::size_of, num::NonZeroU64};
use std::num::NonZeroU64;
use wgpu::util::DeviceExt as _;
use wgpu_test::{gpu_test, valid, GpuTestConfiguration, TestParameters, TestingContext};

View File

@ -1,4 +1,4 @@
use std::{mem::size_of, num::NonZeroU64};
use std::num::NonZeroU64;
use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters};

View File

@ -1,6 +1,6 @@
//! Tests that vertex formats pass through to vertex shaders accurately.
use std::{mem::size_of_val, num::NonZeroU64};
use std::num::NonZeroU64;
use wgpu::util::{BufferInitDescriptor, DeviceExt};

View File

@ -3,7 +3,7 @@
//! We need tests for these as the backends use various schemes to work around the lack
//! of support for things like `gl_BaseInstance` in shaders.
use std::{mem::size_of_val, num::NonZeroU64, ops::Range};
use std::{num::NonZeroU64, ops::Range};
use itertools::Itertools;
use strum::IntoEnumIterator;

View File

@ -103,7 +103,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::{

View File

@ -31,7 +31,7 @@ use wgt::{BufferAddress, DynamicOffset};
use super::{bind::BinderError, memory_init::CommandBufferTextureMemoryActions};
use crate::ray_tracing::TlasAction;
use std::sync::Arc;
use std::{fmt, mem::size_of, str};
use std::{fmt, str};
pub struct ComputePass {
/// All pass data & records is stored here.

View File

@ -46,7 +46,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::{

View File

@ -4,7 +4,6 @@ use std::{
fmt::{self, Debug},
hash::Hash,
marker::PhantomData,
mem::size_of,
num::NonZeroU64,
};
use wgt::WasmNotSendSync;

View File

@ -1,4 +1,3 @@
use std::mem::size_of;
use std::num::NonZeroU64;
use thiserror::Error;

View File

@ -1,5 +1,3 @@
use std::mem::size_of;
use thiserror::Error;
use wgt::AdapterInfo;

View File

@ -13,7 +13,7 @@ use crate::{
id::{BlasId, BufferId, TlasId},
resource::CreateBufferError,
};
use std::{mem::size_of, sync::Arc};
use std::sync::Arc;
use std::{num::NonZeroU64, slice};
use crate::resource::{Blas, ResourceErrorIdent, Tlas};

View File

@ -1,4 +1,4 @@
use std::{mem::size_of, sync::Arc};
use std::sync::Arc;
use crate::{
id::Id,

View File

@ -14,9 +14,7 @@ use winit::{
use std::{
borrow::{Borrow, Cow},
iter,
mem::size_of,
ptr,
iter, ptr,
time::Instant,
};

View File

@ -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;

View File

@ -1,9 +1,4 @@
use std::{
mem::{size_of, size_of_val},
ptr,
sync::Arc,
thread,
};
use std::{ptr, sync::Arc, thread};
use parking_lot::Mutex;
use windows::{

View File

@ -1,6 +1,5 @@
use std::{
ffi,
mem::{self, size_of, size_of_val},
ffi, mem,
num::NonZeroU32,
ptr,
sync::Arc,

View File

@ -1,4 +1,4 @@
use std::{mem::size_of_val, sync::Arc};
use std::sync::Arc;
use parking_lot::RwLock;
use windows::{

View File

@ -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 {

View File

@ -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},
};

View File

@ -1,7 +1,7 @@
use std::{
collections::HashSet,
ffi::{c_void, CStr, CString},
mem::{self, size_of, size_of_val, ManuallyDrop},
mem::{self, ManuallyDrop},
os::raw::c_int,
ptr,
sync::{

View File

@ -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;

View File

@ -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;

View File

@ -18,7 +18,6 @@ use serde::Deserialize;
#[cfg(any(feature = "serde", test))]
use serde::Serialize;
use std::hash::{Hash, Hasher};
use std::mem::size_of;
use std::path::PathBuf;
use std::{num::NonZeroU32, ops::Range};

View File

@ -32,8 +32,6 @@ macro_rules! vertex_attr_array {
#[test]
fn test_vertex_attr_array() {
use std::mem::size_of;
let attrs = vertex_attr_array![0 => Float32x2, 3 => Uint16x4];
// VertexAttribute does not support PartialEq, so we cannot test directly
assert_eq!(attrs.len(), 2);

View File

@ -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};