mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
simplify std::mem references (#15315)
# Objective - Fixes #15314 ## Solution - Remove unnecessary usings and simplify references to those functions. ## Testing CI
This commit is contained in:
parent
612897becd
commit
1b8c1c1242
20 changed files with 13 additions and 24 deletions
|
@ -10,7 +10,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
|
|||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/bevyengine/bevy"
|
||||
documentation = "https://docs.rs/bevy"
|
||||
rust-version = "1.79.0"
|
||||
rust-version = "1.80.0"
|
||||
|
||||
[workspace]
|
||||
exclude = [
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
use std::mem::size_of;
|
||||
|
||||
use bevy_ecs::{
|
||||
component::Component,
|
||||
entity::Entity,
|
||||
|
|
|
@ -1115,7 +1115,7 @@ impl Termination for AppExit {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{iter, marker::PhantomData, mem::size_of, sync::Mutex};
|
||||
use std::{iter, marker::PhantomData, sync::Mutex};
|
||||
|
||||
use bevy_ecs::{
|
||||
change_detection::{DetectChanges, ResMut},
|
||||
|
|
|
@ -26,7 +26,6 @@ use futures_io::{AsyncRead, AsyncSeek, AsyncWrite};
|
|||
use futures_lite::{ready, Stream};
|
||||
use std::{
|
||||
io::SeekFrom,
|
||||
mem::size_of,
|
||||
path::{Path, PathBuf},
|
||||
pin::Pin,
|
||||
sync::Arc,
|
||||
|
|
|
@ -1006,7 +1006,6 @@ impl EntityLocation {
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::mem::size_of;
|
||||
|
||||
#[test]
|
||||
fn entity_niche_optimization() {
|
||||
|
|
|
@ -505,7 +505,7 @@ mod tests {
|
|||
use crate::{component::Component, ptr::OwningPtr, world::World};
|
||||
|
||||
use super::BlobVec;
|
||||
use std::{alloc::Layout, cell::RefCell, mem::align_of, rc::Rc};
|
||||
use std::{alloc::Layout, cell::RefCell, rc::Rc};
|
||||
|
||||
/// # Safety
|
||||
///
|
||||
|
|
|
@ -2502,7 +2502,7 @@ impl World {
|
|||
/// total += info.layout().size();
|
||||
/// }
|
||||
/// println!("Total size: {} bytes", total);
|
||||
/// # assert_eq!(total, std::mem::size_of::<A>() + std::mem::size_of::<B>());
|
||||
/// # assert_eq!(total, size_of::<A>() + size_of::<B>());
|
||||
/// ```
|
||||
///
|
||||
/// ## Dynamically running closures for resources matching specific `TypeId`s
|
||||
|
|
|
@ -13,7 +13,7 @@ use bevy_render::{
|
|||
renderer::{RenderDevice, RenderQueue},
|
||||
};
|
||||
use bevy_utils::HashMap;
|
||||
use std::{mem::size_of, ops::Range, sync::Arc};
|
||||
use std::{ops::Range, sync::Arc};
|
||||
|
||||
/// Manages uploading [`MeshletMesh`] asset data to the GPU.
|
||||
#[derive(Resource)]
|
||||
|
|
|
@ -2,7 +2,7 @@ use super::{
|
|||
asset::{Meshlet, MeshletBoundingSpheres},
|
||||
persistent_buffer::PersistentGpuBufferable,
|
||||
};
|
||||
use std::{mem::size_of, sync::Arc};
|
||||
use std::sync::Arc;
|
||||
|
||||
const MESHLET_VERTEX_SIZE_IN_BYTES: u32 = 48;
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ use binding_types::*;
|
|||
use encase::internal::WriteInto;
|
||||
use std::{
|
||||
array, iter,
|
||||
mem::size_of,
|
||||
sync::{atomic::AtomicBool, Arc},
|
||||
};
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ use bevy_math::Mat4;
|
|||
use bevy_render::{
|
||||
mesh::morph::MAX_MORPH_WEIGHTS, render_resource::*, renderer::RenderDevice, texture::GpuImage,
|
||||
};
|
||||
use std::mem::size_of;
|
||||
|
||||
use crate::render::skin::MAX_JOINTS;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{iter, mem, mem::size_of};
|
||||
use std::{iter, mem};
|
||||
|
||||
use bevy_ecs::entity::EntityHashMap;
|
||||
use bevy_ecs::prelude::*;
|
||||
|
|
|
@ -603,7 +603,6 @@ trait DebugEnsureAligned {
|
|||
impl<T: Sized> DebugEnsureAligned for *mut T {
|
||||
#[track_caller]
|
||||
fn debug_ensure_aligned(self) -> Self {
|
||||
use core::mem::align_of;
|
||||
let align = align_of::<T>();
|
||||
// Implementation shamelessly borrowed from the currently unstable
|
||||
// ptr.is_aligned_to.
|
||||
|
|
|
@ -11,7 +11,7 @@ use bevy_hierarchy::Children;
|
|||
use bevy_math::Vec3;
|
||||
use bevy_reflect::prelude::*;
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::{iter, mem::size_of};
|
||||
use std::iter;
|
||||
use thiserror::Error;
|
||||
|
||||
const MAX_TEXTURE_WIDTH: u32 = 2048;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{iter, marker::PhantomData, mem::size_of};
|
||||
use std::{iter, marker::PhantomData};
|
||||
|
||||
use crate::{
|
||||
render_resource::Buffer,
|
||||
|
@ -123,7 +123,7 @@ impl<T: NoUninit> RawBufferVec<T> {
|
|||
}
|
||||
|
||||
/// Creates a [`Buffer`] on the [`RenderDevice`] with size
|
||||
/// at least `std::mem::size_of::<T>() * capacity`, unless a such a buffer already exists.
|
||||
/// at least `size_of::<T>() * capacity`, unless a such a buffer already exists.
|
||||
///
|
||||
/// If a [`Buffer`] exists, but is too small, references to it will be discarded,
|
||||
/// and a new [`Buffer`] will be created. Any previously created [`Buffer`]s
|
||||
|
@ -302,7 +302,7 @@ where
|
|||
}
|
||||
|
||||
/// Creates a [`Buffer`] on the [`RenderDevice`] with size
|
||||
/// at least `std::mem::size_of::<T>() * capacity`, unless such a buffer already exists.
|
||||
/// at least `size_of::<T>() * capacity`, unless such a buffer already exists.
|
||||
///
|
||||
/// If a [`Buffer`] exists, but is too small, references to it will be discarded,
|
||||
/// and a new [`Buffer`] will be created. Any previously created [`Buffer`]s
|
||||
|
|
|
@ -537,7 +537,6 @@ mod test {
|
|||
use super::*;
|
||||
use bevy_app::prelude::*;
|
||||
use bevy_hierarchy::BuildChildren;
|
||||
use std::mem::size_of;
|
||||
|
||||
fn visibility_bundle(visibility: Visibility) -> VisibilityBundle {
|
||||
VisibilityBundle {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//! This example show how you can create components dynamically, spawn entities with those components
|
||||
//! as well as query for entities with those components.
|
||||
|
||||
use std::{alloc::Layout, io::Write, mem::size_of, ptr::NonNull};
|
||||
use std::{alloc::Layout, io::Write, ptr::NonNull};
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy::{
|
||||
|
|
|
@ -36,7 +36,6 @@ use bevy::{
|
|||
},
|
||||
};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::mem::size_of;
|
||||
|
||||
/// A marker component that represents an entity that is to be rendered using
|
||||
/// our custom phase item.
|
||||
|
|
|
@ -17,7 +17,6 @@ use bevy::{
|
|||
},
|
||||
};
|
||||
use crossbeam_channel::{Receiver, Sender};
|
||||
use std::mem::size_of;
|
||||
|
||||
/// This example uses a shader source file from the assets subdirectory
|
||||
const SHADER_ASSET_PATH: &str = "shaders/gpu_readback.wgsl";
|
||||
|
|
|
@ -27,7 +27,6 @@ use bevy::{
|
|||
},
|
||||
};
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
use std::mem::size_of;
|
||||
|
||||
/// This example uses a shader source file from the assets subdirectory
|
||||
const SHADER_ASSET_PATH: &str = "shaders/instancing.wgsl";
|
||||
|
|
Loading…
Reference in a new issue