diff --git a/crates/bevy_app/src/app.rs b/crates/bevy_app/src/app.rs
index be19d82da4910..de317e634a856 100644
--- a/crates/bevy_app/src/app.rs
+++ b/crates/bevy_app/src/app.rs
@@ -378,7 +378,7 @@ impl App {
/// #
/// app.add_system(my_system);
/// ```
- pub fn add_system
(&mut self, system: impl IntoSystemConfig
) -> &mut Self {
+ pub fn add_system(&mut self, system: impl IntoSystemConfig) -> &mut Self {
let mut schedules = self.world.resource_mut::();
if let Some(default_schedule) = schedules.get_mut(&*self.default_schedule_label) {
@@ -406,7 +406,7 @@ impl App {
/// #
/// app.add_systems((system_a, system_b, system_c));
/// ```
- pub fn add_systems(&mut self, systems: impl IntoSystemConfigs
) -> &mut Self {
+ pub fn add_systems(&mut self, systems: impl IntoSystemConfigs) -> &mut Self {
let mut schedules = self.world.resource_mut::();
if let Some(default_schedule) = schedules.get_mut(&*self.default_schedule_label) {
@@ -420,10 +420,10 @@ impl App {
}
/// Adds a system to the provided [`Schedule`].
- pub fn add_system_to_schedule(
+ pub fn add_system_to_schedule(
&mut self,
schedule_label: impl ScheduleLabel,
- system: impl IntoSystemConfig,
+ system: impl IntoSystemConfig,
) -> &mut Self {
let mut schedules = self.world.resource_mut::();
@@ -437,10 +437,10 @@ impl App {
}
/// Adds a collection of system to the provided [`Schedule`].
- pub fn add_systems_to_schedule(
+ pub fn add_systems_to_schedule(
&mut self,
schedule_label: impl ScheduleLabel,
- systems: impl IntoSystemConfigs,
+ systems: impl IntoSystemConfigs,
) -> &mut Self {
let mut schedules = self.world.resource_mut::();
@@ -471,7 +471,7 @@ impl App {
/// App::new()
/// .add_startup_system(my_startup_system);
/// ```
- pub fn add_startup_system(&mut self, system: impl IntoSystemConfig
) -> &mut Self {
+ pub fn add_startup_system(&mut self, system: impl IntoSystemConfig) -> &mut Self {
self.add_system_to_schedule(CoreSchedule::Startup, system)
}
@@ -496,7 +496,7 @@ impl App {
/// )
/// );
/// ```
- pub fn add_startup_systems(&mut self, systems: impl IntoSystemConfigs
) -> &mut Self {
+ pub fn add_startup_systems(&mut self, systems: impl IntoSystemConfigs) -> &mut Self {
self.add_systems_to_schedule(CoreSchedule::Startup, systems)
}
diff --git a/crates/bevy_ecs/src/schedule/condition.rs b/crates/bevy_ecs/src/schedule/condition.rs
index 225c54095f520..040d53d6ca0bb 100644
--- a/crates/bevy_ecs/src/schedule/condition.rs
+++ b/crates/bevy_ecs/src/schedule/condition.rs
@@ -8,7 +8,7 @@ pub type BoxedCondition = Box>;
///
/// Implemented for functions and closures that convert into [`System`](crate::system::System)
/// with [read-only](crate::system::ReadOnlySystemParam) parameters.
-pub trait Condition: sealed::Condition {
+pub trait Condition: sealed::Condition {
/// Returns a new run condition that only returns `true`
/// if both this one and the passed `and_then` return `true`.
///
@@ -53,7 +53,7 @@ pub trait Condition: sealed::Condition {
/// Note that in this case, it's better to just use the run condition [`resource_exists_and_equals`].
///
/// [`resource_exists_and_equals`]: common_conditions::resource_exists_and_equals
- fn and_then>(self, and_then: C) -> AndThen {
+ fn and_then>(self, and_then: C) -> AndThen {
let a = IntoSystem::into_system(self);
let b = IntoSystem::into_system(and_then);
let name = format!("{} && {}", a.name(), b.name());
@@ -100,7 +100,7 @@ pub trait Condition: sealed::Condition {
/// # app.run(&mut world);
/// # assert!(world.resource::().0);
/// ```
- fn or_else>(self, or_else: C) -> OrElse {
+ fn or_else>(self, or_else: C) -> OrElse {
let a = IntoSystem::into_system(self);
let b = IntoSystem::into_system(or_else);
let name = format!("{} || {}", a.name(), b.name());
@@ -108,22 +108,22 @@ pub trait Condition: sealed::Condition {
}
}
-impl Condition for F where F: sealed::Condition {}
+impl Condition for F where F: sealed::Condition {}
mod sealed {
use crate::system::{IntoSystem, ReadOnlySystem};
- pub trait Condition:
- IntoSystem<(), bool, Params, System = Self::ReadOnlySystem>
+ pub trait Condition:
+ IntoSystem<(), bool, Marker, System = Self::ReadOnlySystem>
{
// This associated type is necessary to let the compiler
// know that `Self::System` is `ReadOnlySystem`.
type ReadOnlySystem: ReadOnlySystem;
}
- impl Condition for F
+ impl Condition for F
where
- F: IntoSystem<(), bool, Params>,
+ F: IntoSystem<(), bool, Marker>,
F::System: ReadOnlySystem,
{
type ReadOnlySystem = F::System;
@@ -373,8 +373,8 @@ pub mod common_conditions {
/// #
/// # fn my_system() { unreachable!() }
/// ```
- pub fn not(
- condition: impl Condition,
+ pub fn not(
+ condition: impl Condition,
) -> impl ReadOnlySystem {
condition.pipe(|In(val): In| !val)
}
diff --git a/crates/bevy_ecs/src/schedule/config.rs b/crates/bevy_ecs/src/schedule/config.rs
index 28fe775acd903..54f68a8167e05 100644
--- a/crates/bevy_ecs/src/schedule/config.rs
+++ b/crates/bevy_ecs/src/schedule/config.rs
@@ -54,7 +54,7 @@ impl SystemConfig {
}
}
-fn new_condition(condition: impl Condition
) -> BoxedCondition {
+fn new_condition(condition: impl Condition) -> BoxedCondition {
let condition_system = IntoSystem::into_system(condition);
assert!(
condition_system.is_send(),
@@ -100,7 +100,7 @@ pub trait IntoSystemSetConfig: sealed::IntoSystemSetConfig {
///
/// The `Condition` will be evaluated at most once (per schedule run),
/// the first time a system in this set prepares to run.
- fn run_if(self, condition: impl Condition
) -> SystemSetConfig;
+ fn run_if(self, condition: impl Condition) -> SystemSetConfig;
/// Suppress warnings and errors that would result from systems in this set having ambiguities
/// (conflicting access but indeterminate order) with systems in `set`.
fn ambiguous_with(self, set: impl IntoSystemSet) -> SystemSetConfig;
@@ -139,7 +139,7 @@ where
self.into_config().after(set)
}
- fn run_if(self, condition: impl Condition
) -> SystemSetConfig {
+ fn run_if(self, condition: impl Condition) -> SystemSetConfig {
self.into_config().run_if(condition)
}
@@ -179,7 +179,7 @@ impl IntoSystemSetConfig for BoxedSystemSet {
self.into_config().after(set)
}
- fn run_if(self, condition: impl Condition
) -> SystemSetConfig {
+ fn run_if(self, condition: impl Condition) -> SystemSetConfig {
self.into_config().run_if(condition)
}
@@ -254,7 +254,7 @@ impl IntoSystemSetConfig for SystemSetConfig {
self
}
- fn run_if(mut self, condition: impl Condition
) -> Self {
+ fn run_if(mut self, condition: impl Condition) -> Self {
self.conditions.push(new_condition(condition));
self
}
@@ -274,7 +274,7 @@ impl IntoSystemSetConfig for SystemSetConfig {
///
/// This has been implemented for boxed [`System`](crate::system::System)
/// trait objects and all functions that turn into such.
-pub trait IntoSystemConfig: sealed::IntoSystemConfig {
+pub trait IntoSystemConfig: sealed::IntoSystemConfig {
/// Convert into a [`SystemConfig`].
#[doc(hidden)]
fn into_config(self) -> SystemConfig;
@@ -294,7 +294,7 @@ pub trait IntoSystemConfig: sealed::IntoSystemConfig {
///
/// The `Condition` will be evaluated at most once (per schedule run),
/// when the system prepares to run.
- fn run_if(self, condition: impl Condition
) -> SystemConfig;
+ fn run_if(self, condition: impl Condition) -> SystemConfig;
/// Suppress warnings and errors that would result from this system having ambiguities
/// (conflicting access but indeterminate order) with systems in `set`.
fn ambiguous_with(self, set: impl IntoSystemSet) -> SystemConfig;
@@ -303,9 +303,9 @@ pub trait IntoSystemConfig: sealed::IntoSystemConfig {
fn ambiguous_with_all(self) -> SystemConfig;
}
-impl IntoSystemConfig for F
+impl IntoSystemConfig for F
where
- F: IntoSystem<(), (), Params> + sealed::IntoSystemConfig,
+ F: IntoSystem<(), (), Marker> + sealed::IntoSystemConfig,
{
fn into_config(self) -> SystemConfig {
SystemConfig::new(Box::new(IntoSystem::into_system(self)))
@@ -333,7 +333,7 @@ where
self.into_config().after(set)
}
- fn run_if(self, condition: impl Condition
) -> SystemConfig {
+ fn run_if(self, condition: impl Condition) -> SystemConfig {
self.into_config().run_if(condition)
}
@@ -373,7 +373,7 @@ impl IntoSystemConfig<()> for BoxedSystem<(), ()> {
self.into_config().after(set)
}
- fn run_if(self, condition: impl Condition
) -> SystemConfig {
+ fn run_if(self, condition: impl Condition) -> SystemConfig {
self.into_config().run_if(condition)
}
@@ -440,7 +440,7 @@ impl IntoSystemConfig<()> for SystemConfig {
self
}
- fn run_if(mut self, condition: impl Condition
) -> Self {
+ fn run_if(mut self, condition: impl Condition) -> Self {
self.conditions.push(new_condition(condition));
self
}
@@ -465,9 +465,9 @@ mod sealed {
use super::{SystemConfig, SystemSetConfig};
- pub trait IntoSystemConfig {}
+ pub trait IntoSystemConfig {}
- impl> IntoSystemConfig for F {}
+ impl> IntoSystemConfig for F {}
impl IntoSystemConfig<()> for BoxedSystem<(), ()> {}
@@ -490,7 +490,7 @@ pub struct SystemConfigs {
}
/// Types that can convert into a [`SystemConfigs`].
-pub trait IntoSystemConfigs
+pub trait IntoSystemConfigs
where
Self: Sized,
{
@@ -550,7 +550,7 @@ where
/// Use [`run_if`](IntoSystemSetConfig::run_if) on a [`SystemSet`] if you want to make sure
/// that either all or none of the systems are run, or you don't want to evaluate the run
/// condition for each contained system separately.
- fn distributive_run_if(self, condition: impl Condition
+ Clone) -> SystemConfigs {
+ fn distributive_run_if(self, condition: impl Condition + Clone) -> SystemConfigs {
self.into_configs().distributive_run_if(condition)
}
@@ -637,7 +637,7 @@ impl IntoSystemConfigs<()> for SystemConfigs {
self
}
- fn distributive_run_if(mut self, condition: impl Condition
+ Clone) -> SystemConfigs {
+ fn distributive_run_if(mut self, condition: impl Condition + Clone) -> SystemConfigs {
for config in &mut self.systems {
config.conditions.push(new_condition(condition.clone()));
}
diff --git a/crates/bevy_ecs/src/schedule/schedule.rs b/crates/bevy_ecs/src/schedule/schedule.rs
index 04aaafbccb255..6ce97433c58c9 100644
--- a/crates/bevy_ecs/src/schedule/schedule.rs
+++ b/crates/bevy_ecs/src/schedule/schedule.rs
@@ -190,13 +190,13 @@ impl Schedule {
}
/// Add a system to the schedule.
- pub fn add_system(&mut self, system: impl IntoSystemConfig
) -> &mut Self {
+ pub fn add_system(&mut self, system: impl IntoSystemConfig) -> &mut Self {
self.graph.add_system(system);
self
}
/// Add a collection of systems to the schedule.
- pub fn add_systems(&mut self, systems: impl IntoSystemConfigs
) -> &mut Self {
+ pub fn add_systems(&mut self, systems: impl IntoSystemConfigs) -> &mut Self {
self.graph.add_systems(systems);
self
}
@@ -556,7 +556,7 @@ impl ScheduleGraph {
&self.conflicting_systems
}
- fn add_systems(&mut self, systems: impl IntoSystemConfigs
) {
+ fn add_systems(&mut self, systems: impl IntoSystemConfigs) {
let SystemConfigs { systems, chained } = systems.into_configs();
let mut system_iter = systems.into_iter();
if chained {
@@ -574,13 +574,13 @@ impl ScheduleGraph {
}
}
- fn add_system(&mut self, system: impl IntoSystemConfig
) {
+ fn add_system(&mut self, system: impl IntoSystemConfig) {
self.add_system_inner(system).unwrap();
}
- fn add_system_inner(
+ fn add_system_inner(
&mut self,
- system: impl IntoSystemConfig,
+ system: impl IntoSystemConfig,
) -> Result {
let SystemConfig {
system,
diff --git a/crates/bevy_ecs/src/system/function_system.rs b/crates/bevy_ecs/src/system/function_system.rs
index 07e801898a011..aa87b75a29282 100644
--- a/crates/bevy_ecs/src/system/function_system.rs
+++ b/crates/bevy_ecs/src/system/function_system.rs
@@ -319,7 +319,7 @@ impl FromWorld for SystemState {
// This trait has to be generic because we have potentially overlapping impls, in particular
// because Rust thinks a type could impl multiple different `FnMut` combinations
// even though none can currently
-pub trait IntoSystem: Sized {
+pub trait IntoSystem: Sized {
type System: System;
/// Turns this value into its corresponding [`System`].
fn into_system(this: Self) -> Self::System;
diff --git a/crates/bevy_ecs/src/system/mod.rs b/crates/bevy_ecs/src/system/mod.rs
index 7ef6780544727..0e88adf24e81d 100644
--- a/crates/bevy_ecs/src/system/mod.rs
+++ b/crates/bevy_ecs/src/system/mod.rs
@@ -124,7 +124,7 @@ pub use system_piping::*;
/// This should be used when writing doc examples,
/// to confirm that systems used in an example are
/// valid systems.
-pub fn assert_is_system>(sys: S) {
+pub fn assert_is_system>(sys: S) {
if false {
// Check it can be converted into a system
// TODO: This should ensure that the system has no conflicting system params
@@ -137,7 +137,7 @@ pub fn assert_is_system>(sys: S)
/// This should be used when writing doc examples,
/// to confirm that systems used in an example are
/// valid systems.
-pub fn assert_is_read_only_system>(sys: S)
+pub fn assert_is_read_only_system>(sys: S)
where
S::System: ReadOnlySystem,
{
@@ -208,7 +208,7 @@ mod tests {
system.run((), &mut world);
}
- fn run_system>(world: &mut World, system: S) {
+ fn run_system>(world: &mut World, system: S) {
let mut schedule = Schedule::default();
schedule.add_system(system);
schedule.run(world);
@@ -475,7 +475,7 @@ mod tests {
_buffer: Vec,
}
- fn test_for_conflicting_resources>(sys: S) {
+ fn test_for_conflicting_resources>(sys: S) {
let mut world = World::default();
world.insert_resource(BufferRes::default());
world.insert_resource(A);