Skip to content

Commit

Permalink
chore: remove std::mem::* imports now unnecessary with Rust 1.80
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 Aug 28, 2024
1 parent adf2be9 commit b720c77
Show file tree
Hide file tree
Showing 21 changed files with 16 additions and 38 deletions.
2 changes: 1 addition & 1 deletion examples/src/boids/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion examples/src/cube/mod.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion examples/src/mipmap/mod.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 0 additions & 2 deletions examples/src/repeated_compute/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion examples/src/shadow/mod.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
1 change: 0 additions & 1 deletion examples/src/stencil_triangles/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bytemuck::{Pod, Zeroable};
use std::borrow::Cow;
use std::mem::size_of;
use wgpu::util::DeviceExt;

#[repr(C)]
Expand Down
2 changes: 1 addition & 1 deletion examples/src/water/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

///
Expand Down
2 changes: 1 addition & 1 deletion naga/src/back/msl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<Error>(), 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 @@ -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::{
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 @@ -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};

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;
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::{
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 winit::window::WindowButtons;
Expand Down
1 change: 0 additions & 1 deletion wgpu-hal/src/dx12/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,6 @@ struct PassState {

#[test]
fn test_dirty_mask() {
use std::mem::size_of;
assert_eq!(MAX_ROOT_ELEMENTS, (u64::BITS as usize));
}

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/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
6 changes: 1 addition & 5 deletions wgpu/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down

0 comments on commit b720c77

Please sign in to comment.