Skip to content

Commit 023a41c

Browse files
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](rust-lang/rust#123168).
1 parent b92480d commit 023a41c

File tree

43 files changed

+30
-74
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+30
-74
lines changed

examples/src/boids/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// adapted from https://github.com/austinEng/webgpu-samples/blob/master/src/examples/computeBoids.ts
33

44
use nanorand::{Rng, WyRand};
5-
use std::{borrow::Cow, mem::size_of};
5+
use std::borrow::Cow;
66
use wgpu::util::DeviceExt;
77

88
// number of boid particles to simulate

examples/src/cube/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bytemuck::{Pod, Zeroable};
2-
use std::{borrow::Cow, f32::consts, mem::size_of};
2+
use std::{borrow::Cow, f32::consts};
33
use wgpu::util::DeviceExt;
44

55
#[repr(C)]

examples/src/hello_compute/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{borrow::Cow, mem::size_of_val, str::FromStr};
1+
use std::{borrow::Cow, str::FromStr};
22
use wgpu::util::DeviceExt;
33

44
// Indicates a u32 overflow in an intermediate Collatz value

examples/src/hello_synchronization/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::mem::size_of_val;
2-
31
const ARR_SIZE: usize = 128;
42

53
struct ExecuteResults {

examples/src/hello_workgroups/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
//!
88
//! Only parts specific to this example will be commented.
99
10-
use std::mem::size_of_val;
11-
1210
use wgpu::util::DeviceExt;
1311

1412
async fn run() {

examples/src/mipmap/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bytemuck::{Pod, Zeroable};
2-
use std::{borrow::Cow, f32::consts, mem::size_of};
2+
use std::{borrow::Cow, f32::consts};
33
use wgpu::util::DeviceExt;
44

55
const TEXTURE_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8UnormSrgb;

examples/src/msaa_line/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! * Set the primitive_topology to PrimitiveTopology::LineList.
88
//! * Vertices and Indices describe the two points that make up a line.
99
10-
use std::{borrow::Cow, iter, mem::size_of};
10+
use std::{borrow::Cow, iter};
1111

1212
use bytemuck::{Pod, Zeroable};
1313
use wgpu::util::DeviceExt;

examples/src/repeated_compute/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
//! hello-compute example does not such as mapping buffers
66
//! and why use the async channels.
77
8-
use std::mem::size_of_val;
9-
108
const OVERFLOW: u32 = 0xffffffff;
119

1210
async fn run() {

examples/src/shadow/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{borrow::Cow, f32::consts, iter, mem::size_of, ops::Range, sync::Arc};
1+
use std::{borrow::Cow, f32::consts, iter, ops::Range, sync::Arc};
22

33
use bytemuck::{Pod, Zeroable};
44
use wgpu::util::{align_to, DeviceExt};

examples/src/skybox/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use bytemuck::{Pod, Zeroable};
2-
use std::{borrow::Cow, f32::consts, mem::size_of};
2+
use std::{borrow::Cow, f32::consts};
33
use wgpu::{util::DeviceExt, AstcBlock, AstcChannel};
44

55
const IMAGE_SIZE: u32 = 256;

examples/src/stencil_triangles/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use bytemuck::{Pod, Zeroable};
22
use std::borrow::Cow;
3-
use std::mem::size_of;
43
use wgpu::util::DeviceExt;
54

65
#[repr(C)]

examples/src/storage_texture/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
//! A lot of things aren't explained here via comments. See hello-compute and
1515
//! repeated-compute for code that is more thoroughly commented.
1616
17-
use std::mem::size_of_val;
18-
1917
#[cfg(not(target_arch = "wasm32"))]
2018
use crate::utils::output_image_native;
2119
#[cfg(target_arch = "wasm32")]

examples/src/texture_arrays/mod.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use bytemuck::{Pod, Zeroable};
2-
use std::{
3-
mem::size_of,
4-
num::{NonZeroU32, NonZeroU64},
5-
};
2+
use std::num::{NonZeroU32, NonZeroU64};
63
use wgpu::util::DeviceExt;
74

85
#[repr(C)]

examples/src/timestamp_queries/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
//! 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`
1818
//! in order to get comparable results.
1919
20-
use std::mem::size_of;
21-
2220
use wgpu::util::DeviceExt;
2321

2422
struct Queries {

examples/src/uniform_values/mod.rs

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

examples/src/water/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ mod point_gen;
33
use bytemuck::{Pod, Zeroable};
44
use glam::Vec3;
55
use nanorand::{Rng, WyRand};
6-
use std::{borrow::Cow, f32::consts, iter, mem::size_of};
6+
use std::{borrow::Cow, f32::consts, iter};
77
use wgpu::util::DeviceExt;
88

99
///

naga/src/back/msl/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,5 @@ pub fn write_string(
669669

670670
#[test]
671671
fn test_error_size() {
672-
use std::mem::size_of;
673672
assert_eq!(size_of::<Error>(), 32);
674673
}

player/tests/test.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use player::GlobalPlay;
1414
use std::{
1515
fs::{read_to_string, File},
1616
io::{Read, Seek, SeekFrom},
17-
mem::size_of,
1817
path::{Path, PathBuf},
1918
slice,
2019
};

tests/tests/compute_pass_ownership.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Tests that compute passes take ownership of resources that are associated with.
22
//! I.e. once a resource is passed in to a compute pass, it can be dropped.
33
4-
use std::{mem::size_of, num::NonZeroU64};
4+
use std::num::NonZeroU64;
55

66
use wgpu::util::DeviceExt as _;
77
use wgpu_test::{gpu_test, valid, GpuTestConfiguration, TestParameters, TestingContext};

tests/tests/occlusion_query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{borrow::Cow, mem::size_of};
1+
use std::borrow::Cow;
22
use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration, TestParameters};
33

44
#[gpu_test]

tests/tests/render_pass_ownership.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! * rpass.multi_draw_indirect_count
1010
//! * rpass.multi_draw_indexed_indirect_count
1111
//!
12-
use std::{mem::size_of, num::NonZeroU64};
12+
use std::num::NonZeroU64;
1313

1414
use wgpu::util::DeviceExt as _;
1515
use wgpu_test::{gpu_test, valid, GpuTestConfiguration, TestParameters, TestingContext};

tests/tests/subgroup_operations/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{borrow::Cow, mem::size_of, num::NonZeroU64};
1+
use std::{borrow::Cow, num::NonZeroU64};
22

33
use wgpu_test::{gpu_test, GpuTestConfiguration, TestParameters};
44

tests/tests/vertex_formats/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Tests that vertex formats pass through to vertex shaders accurately.
22
3-
use std::{mem::size_of_val, num::NonZeroU64};
3+
use std::num::NonZeroU64;
44

55
use wgpu::util::{BufferInitDescriptor, DeviceExt};
66

tests/tests/vertex_indices/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//! We need tests for these as the backends use various schemes to work around the lack
44
//! of support for things like `gl_BaseInstance` in shaders.
55
6-
use std::{mem::size_of_val, num::NonZeroU64, ops::Range};
6+
use std::{num::NonZeroU64, ops::Range};
77

88
use itertools::Itertools;
99
use strum::IntoEnumIterator;

wgpu-core/src/command/bundle.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ use crate::{
103103
};
104104
use arrayvec::ArrayVec;
105105

106-
use std::{borrow::Cow, mem::size_of, num::NonZeroU32, ops::Range, sync::Arc};
106+
use std::{borrow::Cow, num::NonZeroU32, ops::Range, sync::Arc};
107107
use thiserror::Error;
108108

109109
use super::{

wgpu-core/src/command/compute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use thiserror::Error;
2929
use wgt::{BufferAddress, DynamicOffset};
3030

3131
use std::sync::Arc;
32-
use std::{fmt, mem::size_of, str};
32+
use std::{fmt, str};
3333

3434
use super::{bind::BinderError, memory_init::CommandBufferTextureMemoryActions};
3535

wgpu-core/src/command/render.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use serde::Deserialize;
4646
use serde::Serialize;
4747

4848
use std::sync::Arc;
49-
use std::{borrow::Cow, fmt, iter, mem::size_of, num::NonZeroU32, ops::Range, str};
49+
use std::{borrow::Cow, fmt, iter, num::NonZeroU32, ops::Range, str};
5050

5151
use super::render_command::ArcRenderCommand;
5252
use super::{

wgpu-core/src/id.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::{
44
fmt::{self, Debug},
55
hash::Hash,
66
marker::PhantomData,
7-
mem::size_of,
87
num::NonZeroU64,
98
};
109
use wgt::WasmNotSendSync;

wgpu-core/src/pipeline_cache.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::mem::size_of;
2-
31
use thiserror::Error;
42
use wgt::AdapterInfo;
53

wgpu-core/src/registry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{mem::size_of, sync::Arc};
1+
use std::sync::Arc;
22

33
use crate::{
44
id::Id,

wgpu-hal/examples/halmark/main.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ use winit::{
1414

1515
use std::{
1616
borrow::{Borrow, Cow},
17-
iter,
18-
mem::size_of,
19-
ptr,
17+
iter, ptr,
2018
time::Instant,
2119
};
2220

wgpu-hal/examples/ray-traced-triangle/main.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ use raw_window_handle::{HasDisplayHandle, HasWindowHandle};
88
use glam::{Affine3A, Mat4, Vec3};
99
use std::{
1010
borrow::{Borrow, Cow},
11-
iter,
12-
mem::size_of,
13-
ptr,
11+
iter, ptr,
1412
time::Instant,
1513
};
1614
use winit::window::WindowButtons;

wgpu-hal/src/dx12/adapter.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
use std::{
2-
mem::{size_of, size_of_val},
3-
ptr,
4-
sync::Arc,
5-
thread,
6-
};
1+
use std::{ptr, sync::Arc, thread};
72

83
use parking_lot::Mutex;
94
use windows::{

wgpu-hal/src/dx12/device.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::{
2-
ffi,
3-
mem::{self, size_of},
2+
ffi, mem,
43
num::NonZeroU32,
54
ptr,
65
sync::Arc,

wgpu-hal/src/dx12/instance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::{mem::size_of_val, sync::Arc};
1+
use std::sync::Arc;
22

33
use parking_lot::RwLock;
44
use windows::{

wgpu-hal/src/gles/command.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
use super::{conv, Command as C};
22
use arrayvec::ArrayVec;
3-
use std::{
4-
mem::{self, size_of, size_of_val},
5-
ops::Range,
6-
};
3+
use std::{mem, ops::Range};
74

85
#[derive(Clone, Copy, Debug, Default)]
96
struct TextureSlotDesc {

wgpu-hal/src/gles/queue.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use super::{conv::is_layered_target, Command as C, PrivateCapabilities};
22
use arrayvec::ArrayVec;
33
use glow::HasContext;
44
use std::{
5-
mem::size_of,
65
slice,
76
sync::{atomic::Ordering, Arc},
87
};

wgpu-hal/src/gles/wgl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::{
22
collections::HashSet,
33
ffi::{c_void, CStr, CString},
4-
mem::{self, size_of, size_of_val, ManuallyDrop},
4+
mem::{self, ManuallyDrop},
55
os::raw::c_int,
66
ptr,
77
sync::{

wgpu-hal/src/metal/command.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use super::{conv, AsNative, TimestampQuerySupport};
22
use crate::CommandEncoder as _;
3-
use std::{borrow::Cow, mem::size_of, ops::Range};
3+
use std::{borrow::Cow, ops::Range};
44

55
// has to match `Temp::binding_sizes`
66
const WORD_SIZE: usize = 4;

wgpu-hal/src/vulkan/command.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,7 @@ use super::conv;
33
use arrayvec::ArrayVec;
44
use ash::vk;
55

6-
use std::{
7-
mem::{self, size_of},
8-
ops::Range,
9-
slice,
10-
};
6+
use std::{mem, ops::Range, slice};
117

128
const ALLOCATION_GRANULARITY: u32 = 16;
139
const DST_IMAGE_LAYOUT: vk::ImageLayout = vk::ImageLayout::TRANSFER_DST_OPTIMAL;

wgpu-types/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use serde::Deserialize;
1818
#[cfg(any(feature = "serde", test))]
1919
use serde::Serialize;
2020
use std::hash::{Hash, Hasher};
21-
use std::mem::size_of;
2221
use std::path::PathBuf;
2322
use std::{num::NonZeroU32, ops::Range};
2423

wgpu/src/macros.rs

-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ macro_rules! vertex_attr_array {
3232

3333
#[test]
3434
fn test_vertex_attr_array() {
35-
use std::mem::size_of;
36-
3735
let attrs = vertex_attr_array![0 => Float32x2, 3 => Uint16x4];
3836
// VertexAttribute does not support PartialEq, so we cannot test directly
3937
assert_eq!(attrs.len(), 2);

wgpu/src/util/mod.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ mod encoder;
99
mod init;
1010

1111
use std::sync::Arc;
12-
use std::{
13-
borrow::Cow,
14-
mem::{align_of, size_of},
15-
ptr::copy_nonoverlapping,
16-
};
12+
use std::{borrow::Cow, ptr::copy_nonoverlapping};
1713

1814
pub use belt::StagingBelt;
1915
pub use device::{BufferInitDescriptor, DeviceExt, TextureDataOrder};

0 commit comments

Comments
 (0)