From 96b2ef0dd6016d2b113182ffeac2aa5c02ad5c75 Mon Sep 17 00:00:00 2001 From: Carter Anderson Date: Sat, 7 Nov 2020 18:35:14 -0800 Subject: [PATCH] clippy --- crates/bevy_ecs/src/system/query/mod.rs | 3 +++ crates/bevy_ecs/src/system/query/query_set.rs | 3 +++ crates/bevy_ecs/src/system/system_param.rs | 3 +++ 3 files changed, 9 insertions(+) diff --git a/crates/bevy_ecs/src/system/query/mod.rs b/crates/bevy_ecs/src/system/query/mod.rs index 745b76292d56c5..e8ec4c4f485206 100644 --- a/crates/bevy_ecs/src/system/query/mod.rs +++ b/crates/bevy_ecs/src/system/query/mod.rs @@ -27,6 +27,9 @@ pub enum QueryError { } impl<'a, Q: HecsQuery> Query<'a, Q> { + /// # Safety + /// This will create a Query that could violate memory safety rules. Make sure that this is only called in + /// ways that ensure the Queries have unique mutable access. #[inline] pub unsafe fn new( world: &'a World, diff --git a/crates/bevy_ecs/src/system/query/query_set.rs b/crates/bevy_ecs/src/system/query/query_set.rs index 4cc244b9d5c00e..0380781dc7a61f 100644 --- a/crates/bevy_ecs/src/system/query/query_set.rs +++ b/crates/bevy_ecs/src/system/query/query_set.rs @@ -17,6 +17,9 @@ pub trait QueryTuple { } impl QuerySet { + /// # Safety + /// This will create a set of Query types that could violate memory safety rules. Make sure that this is only called in + /// ways that ensure the Queries have unique mutable access. pub unsafe fn new(world: &World, component_access: &TypeAccess) -> Self { QuerySet { value: T::new(world, component_access), diff --git a/crates/bevy_ecs/src/system/system_param.rs b/crates/bevy_ecs/src/system/system_param.rs index 500508eb8319f1..7d148c498b2c41 100644 --- a/crates/bevy_ecs/src/system/system_param.rs +++ b/crates/bevy_ecs/src/system/system_param.rs @@ -10,6 +10,9 @@ use std::{any::TypeId, sync::Arc}; pub trait SystemParam: Sized { fn init(system_state: &mut SystemState, world: &World, resources: &mut Resources); + /// # Safety + /// This call might access any of the input parameters in a safe way. Make sure the data access is safe in + /// the context of the system scheduler unsafe fn get_param( system_state: &mut SystemState, world: &World,