Skip to content

Commit 8774ab5

Browse files
chore: remove std::mem::* imports now unnecessary with CORE_MSRV
`std::mem::{size,align}_of{,_val}` was added to `std::prelude` in Rust 1.80; see [`rust`#123168](rust-lang/rust#123168).
1 parent 68803e3 commit 8774ab5

File tree

23 files changed

+12
-46
lines changed

23 files changed

+12
-46
lines changed

naga/src/back/msl/mod.rs

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

724724
#[test]
725725
fn test_error_size() {
726-
use std::mem::size_of;
727726
assert_eq!(size_of::<Error>(), 32);
728727
}

naga/src/front/wgsl/error.rs

-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ use std::ops::Range;
1717
use termcolor::{ColorChoice, NoColor, StandardStream};
1818
use thiserror::Error;
1919

20-
#[cfg(test)]
21-
use std::mem::size_of;
22-
2320
#[derive(Clone, Debug)]
2421
pub struct ParseError {
2522
message: String,

naga/src/non_max_u32.rs

-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,5 @@ impl<'de> serde::Deserialize<'de> for NonMaxU32 {
140140

141141
#[test]
142142
fn size() {
143-
use core::mem::size_of;
144143
assert_eq!(size_of::<Option<NonMaxU32>>(), size_of::<u32>());
145144
}

naga/src/proc/typifier.rs

-1
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,5 @@ impl<'a> ResolveContext<'a> {
908908

909909
#[test]
910910
fn test_error_size() {
911-
use std::mem::size_of;
912911
assert_eq!(size_of::<ResolveError>(), 32);
913912
}

wgpu-core/src/command/bundle.rs

-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ use alloc::{
8585
vec::Vec,
8686
};
8787
use core::{
88-
mem::size_of,
8988
num::{NonZeroU32, NonZeroU64},
9089
ops::Range,
9190
};

wgpu-core/src/command/compute.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use thiserror::Error;
22
use wgt::{BufferAddress, DynamicOffset};
33

44
use alloc::{borrow::Cow, boxed::Box, sync::Arc, vec::Vec};
5-
use core::{fmt, mem::size_of, str};
5+
use core::{fmt, str};
66

77
use crate::{
88
binding_model::{

wgpu-core/src/command/render.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use alloc::{borrow::Cow, sync::Arc, vec::Vec};
2-
use core::{fmt, mem::size_of, num::NonZeroU32, ops::Range, str};
2+
use core::{fmt, num::NonZeroU32, ops::Range, str};
33

44
use arrayvec::ArrayVec;
55
use thiserror::Error;

wgpu-core/src/id.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use core::{
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/indirect_validation.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use alloc::{boxed::Box, format, string::ToString as _};
2-
use core::mem::size_of;
32
use core::num::NonZeroU64;
43

54
use thiserror::Error;

wgpu-core/src/pipeline_cache.rs

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

wgpu-core/src/registry.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use alloc::sync::Arc;
2-
use core::mem::size_of;
32

43
use crate::{
54
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 wgpu_types::Dx12BackendOptions;

wgpu-hal/src/dx12/adapter.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
use std::{
2-
mem::{size_of, size_of_val},
3-
ptr,
4-
string::String,
5-
sync::Arc,
6-
thread,
7-
vec::Vec,
8-
};
1+
use std::{ptr, string::String, sync::Arc, thread, vec::Vec};
92

103
use parking_lot::Mutex;
114
use windows::{

wgpu-hal/src/dx12/device.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::{
22
borrow::Cow,
3-
ffi,
4-
mem::{self, size_of, size_of_val},
3+
ffi, mem,
54
num::NonZeroU32,
65
ptr, slice,
76
string::{String, ToString as _},

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, string::String, sync::Arc, vec::Vec};
1+
use std::{string::String, sync::Arc, vec::Vec};
22

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

wgpu-hal/src/gles/command.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
use alloc::string::String;
2-
use core::{
3-
mem::{self, size_of, size_of_val},
4-
ops::Range,
5-
slice,
6-
};
2+
use core::{mem, ops::Range, slice};
73

84
use arrayvec::ArrayVec;
95

wgpu-hal/src/gles/queue.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::{conv::is_layered_target, Command as C, PrivateCapabilities};
22
use alloc::sync::Arc;
33
use arrayvec::ArrayVec;
4-
use core::{mem::size_of, slice, sync::atomic::Ordering};
4+
use core::{slice, sync::atomic::Ordering};
55
use glow::HasContext;
66

77
const DEBUG_ID: u32 = 0;

wgpu-hal/src/gles/wgl.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::{
44
borrow::ToOwned as _,
55
ffi::{c_void, CStr, CString},
6-
mem::{self, size_of, size_of_val, ManuallyDrop},
6+
mem::{self, ManuallyDrop},
77
os::raw::c_int,
88
ptr,
99
string::String,

wgpu-hal/src/metal/command.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use super::{conv, AsNative, TimestampQuerySupport};
22
use crate::CommandEncoder as _;
33
use std::{
44
borrow::{Cow, ToOwned as _},
5-
mem::size_of,
65
ops::Range,
76
vec::Vec,
87
};

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-hal/src/vulkan/device.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::{
22
borrow::{Cow, ToOwned as _},
33
collections::BTreeMap,
44
ffi::{CStr, CString},
5-
mem::{self, size_of, MaybeUninit},
5+
mem::{self, MaybeUninit},
66
num::NonZeroU32,
77
ptr, slice,
88
sync::Arc,

wgpu-types/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ extern crate alloc;
1717
use alloc::{string::String, vec, vec::Vec};
1818
use core::{
1919
hash::{Hash, Hasher},
20-
mem::size_of,
2120
num::NonZeroU32,
2221
ops::Range,
2322
};

0 commit comments

Comments
 (0)