Skip to content

Commit

Permalink
chore: remove std::mem::* imports now unnecessary with CORE_MSRV
Browse files Browse the repository at this point in the history
`std::mem::{size,align}_of{,_val}` was added to `std::prelude` in Rust
1.80; see
[`rust`#123168](rust-lang/rust#123168).
  • Loading branch information
ErichDonGubler committed Jan 22, 2025
1 parent 4338dd9 commit 84d29b8
Show file tree
Hide file tree
Showing 23 changed files with 14 additions and 43 deletions.
1 change: 0 additions & 1 deletion naga/src/back/msl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,6 +697,5 @@ pub fn write_string(

#[test]
fn test_error_size() {
use std::mem::size_of;
assert_eq!(size_of::<Error>(), 32);
}
3 changes: 0 additions & 3 deletions naga/src/front/wgsl/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion naga/src/non_max_u32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>());
}
1 change: 0 additions & 1 deletion naga/src/proc/typifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,5 @@ impl<'a> ResolveContext<'a> {

#[test]
fn test_error_size() {
use std::mem::size_of;
assert_eq!(size_of::<ResolveError>(), 32);
}
2 changes: 1 addition & 1 deletion wgpu-core/src/command/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/command/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use wgt::{BufferAddress, DynamicOffset};

use super::{bind::BinderError, memory_init::CommandBufferTextureMemoryActions};
use crate::ray_tracing::TlasAction;
use std::{fmt, mem::size_of, str, sync::Arc};
use std::{fmt, str, sync::Arc};

pub struct ComputePass {
/// All pass data & records is stored here.
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ use serde::Deserialize;
#[cfg(feature = "serde")]
use serde::Serialize;

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

use super::render_command::ArcRenderCommand;
use super::{
Expand Down
1 change: 0 additions & 1 deletion wgpu-core/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::{
fmt::{self, Debug},
hash::Hash,
marker::PhantomData,
mem::size_of,
num::NonZeroU64,
};
use wgt::WasmNotSendSync;
Expand Down
1 change: 0 additions & 1 deletion wgpu-core/src/indirect_validation.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::mem::size_of;
use std::num::NonZeroU64;

use thiserror::Error;
Expand Down
2 changes: 0 additions & 2 deletions wgpu-core/src/pipeline_cache.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::mem::size_of;

use thiserror::Error;
use wgt::AdapterInfo;

Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/registry.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{mem::size_of, sync::Arc};
use std::sync::Arc;

use crate::{
id::Id,
Expand Down
4 changes: 1 addition & 3 deletions wgpu-hal/examples/halmark/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ use winit::{

use std::{
borrow::{Borrow, Cow},
iter,
mem::size_of,
ptr,
iter, ptr,
time::Instant,
};

Expand Down
4 changes: 1 addition & 3 deletions wgpu-hal/examples/ray-traced-triangle/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 wgt::Dx12BackendOptions;
Expand Down
7 changes: 1 addition & 6 deletions wgpu-hal/src/dx12/adapter.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand Down
3 changes: 1 addition & 2 deletions wgpu-hal/src/dx12/device.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::{
borrow::Cow,
ffi,
mem::{self, size_of, size_of_val},
ffi, mem,
num::NonZeroU32,
ptr, slice,
sync::Arc,
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/dx12/instance.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{mem::size_of_val, sync::Arc};
use std::sync::Arc;

use parking_lot::RwLock;
use windows::{
Expand Down
5 changes: 1 addition & 4 deletions wgpu-hal/src/gles/command.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
1 change: 0 additions & 1 deletion wgpu-hal/src/gles/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
};
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/gles/wgl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{
ffi::{c_void, CStr, CString},
mem::{self, size_of, size_of_val, ManuallyDrop},
mem::{self, ManuallyDrop},
os::raw::c_int,
ptr,
sync::{
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/metal/command.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 1 addition & 5 deletions wgpu-hal/src/vulkan/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion wgpu-hal/src/vulkan/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::{
borrow::Cow,
collections::BTreeMap,
ffi::{CStr, CString},
mem::{self, size_of, MaybeUninit},
mem::{self, MaybeUninit},
num::NonZeroU32,
ptr, slice,
sync::Arc,
Expand Down
1 change: 0 additions & 1 deletion wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ extern crate alloc;
use alloc::{string::String, vec, vec::Vec};
use core::{
hash::{Hash, Hasher},
mem::size_of,
num::NonZeroU32,
ops::Range,
};
Expand Down

0 comments on commit 84d29b8

Please sign in to comment.