diff options
author | HampusM <hampus@hampusmat.com> | 2024-06-20 21:32:46 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2024-06-20 21:32:46 +0200 |
commit | 681fca5c465191e37714ed07937efec8b0c8b197 (patch) | |
tree | fd609df5737a678a32c2bbe17315f1e163a23d48 /ecs/src/system.rs | |
parent | 87a4230d5cbe8741c88edecbecff510bc1736fef (diff) |
refactor(ecs): fix Clippy lints
Diffstat (limited to 'ecs/src/system.rs')
-rw-r--r-- | ecs/src/system.rs | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/ecs/src/system.rs b/ecs/src/system.rs index f8885fc..57b0756 100644 --- a/ecs/src/system.rs +++ b/ecs/src/system.rs @@ -4,11 +4,10 @@ use std::fmt::Debug; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; use std::panic::{RefUnwindSafe, UnwindSafe}; -use std::ptr::addr_of; use seq_macro::seq; -use crate::component::{Component, FromOptionalComponent}; +use crate::component::{Component, FromOptional as FromOptionalComponent}; use crate::lock::WriteGuard; use crate::system::util::check_params_are_compatible; use crate::tuple::{ReduceElement as TupleReduceElement, With as TupleWith}; @@ -88,7 +87,7 @@ macro_rules! impl_system { run: Box::new(|data, world_data| { // SAFETY: The caller of TypeErased::run ensures the lifetime // is correct - let data = unsafe { &*addr_of!(*data) }; + let data = unsafe { &*std::ptr::from_ref(data) }; let me = data .downcast_ref::<Func>() @@ -96,16 +95,14 @@ macro_rules! impl_system { // SAFETY: The caller of TypeErased::run ensures the lifetime // is correct - let world_data = unsafe { - &*(world_data as *const WorldData) - }; + let world_data = unsafe { &*std::ptr::from_ref(world_data) }; me.run(world_data); }), prepare: Box::new(|data, world_data| { // SAFETY: The caller of TypeErased::run ensures the lifetime // is correct - let data = unsafe { &*addr_of!(*data) }; + let data = unsafe { &*std::ptr::from_ref(data) }; let me = data .downcast_ref::<Func>() @@ -113,9 +110,7 @@ macro_rules! impl_system { // SAFETY: The caller of TypeErased::run ensures the lifetime // is correct - let world_data = unsafe { - &*(world_data as *const WorldData) - }; + let world_data = unsafe { &*std::ptr::from_ref(world_data) }; me.prepare(world_data); }), |