Skip to content

Commit e5ffab9

Browse files
committed
Fix formatting
1 parent cfd590c commit e5ffab9

File tree

7 files changed

+35
-25
lines changed

7 files changed

+35
-25
lines changed

crates/bevy_ecs/src/schedule/commands.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ use super::{IntoSystemDescriptor, Schedule, StageLabel};
44

55
#[derive(Default)]
66
pub struct ScheduleCommandQueue {
7-
items: Vec<Box<dyn ScheduleCommand>>
7+
items: Vec<Box<dyn ScheduleCommand>>,
88
}
99

1010
impl ScheduleCommandQueue {
1111
pub fn push<C>(&mut self, command: C)
12-
where
12+
where
1313
C: ScheduleCommand,
1414
{
1515
self.items.push(Box::new(command));
@@ -36,24 +36,22 @@ pub trait ScheduleCommand: Send + Sync + 'static {
3636
}
3737

3838
pub struct ScheduleCommands<'a> {
39-
queue: &'a mut ScheduleCommandQueue
39+
queue: &'a mut ScheduleCommandQueue,
4040
}
4141

4242
impl<'a> ScheduleCommands<'a> {
4343
pub fn new(queue: &'a mut ScheduleCommandQueue) -> Self {
44-
Self {
45-
queue
46-
}
44+
Self { queue }
4745
}
4846

4947
pub fn insert_system<T: 'static, S, Params: 'static>(&mut self, system: T, stage_label: S)
5048
where
5149
T: IntoSystemDescriptor<Params> + Send + Sync,
52-
S: StageLabel
50+
S: StageLabel,
5351
{
5452
self.queue.push(InsertSystem {
55-
system: system,
56-
stage_label: stage_label,
53+
system,
54+
stage_label,
5755
phantom: Default::default(),
5856
});
5957
}
@@ -62,7 +60,7 @@ impl<'a> ScheduleCommands<'a> {
6260
pub struct InsertSystem<T, S, Params>
6361
where
6462
T: IntoSystemDescriptor<Params>,
65-
S: StageLabel
63+
S: StageLabel,
6664
{
6765
pub system: T,
6866
pub stage_label: S,
@@ -72,7 +70,7 @@ where
7270
impl<T: 'static, S, Params: 'static> ScheduleCommand for InsertSystem<T, S, Params>
7371
where
7472
T: IntoSystemDescriptor<Params> + Send + Sync,
75-
S: StageLabel
73+
S: StageLabel,
7674
{
7775
fn write(self: Box<Self>, schedule: &mut Schedule) {
7876
schedule.add_system_to_stage(self.stage_label, self.system);
@@ -82,16 +80,14 @@ where
8280
#[cfg(test)]
8381
mod tests {
8482
use crate::{
85-
schedule::{Schedule, ScheduleCommands, ScheduleCommandQueue, SystemStage},
83+
schedule::{Schedule, ScheduleCommandQueue, ScheduleCommands, SystemStage},
8684
system::Commands,
8785
world::World,
8886
};
8987

9088
#[test]
9189
fn insert_system() {
92-
fn sample_system(mut _commands: Commands) {
93-
94-
}
90+
fn sample_system(mut _commands: Commands) {}
9591
let mut schedule = Schedule::default();
9692
schedule.add_stage("test", SystemStage::parallel());
9793
let mut queue = ScheduleCommandQueue::default();

crates/bevy_ecs/src/schedule/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
mod commands;
12
mod executor;
23
mod executor_parallel;
34
pub mod graph_utils;
@@ -8,8 +9,8 @@ mod state;
89
mod system_container;
910
mod system_descriptor;
1011
mod system_set;
11-
mod commands;
1212

13+
pub use commands::*;
1314
pub use executor::*;
1415
pub use executor_parallel::*;
1516
pub use graph_utils::GraphNode;
@@ -20,7 +21,6 @@ pub use state::*;
2021
pub use system_container::*;
2122
pub use system_descriptor::*;
2223
pub use system_set::*;
23-
pub use commands::*;
2424

2525
use std::fmt::Debug;
2626

crates/bevy_ecs/src/schedule/run_criteria.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,9 @@ impl System for RunOnce {
450450
}
451451

452452
fn apply_buffers(&mut self, _world: &mut World) {}
453-
fn schedule_commands(&mut self) -> Option<ScheduleCommandQueue> { None }
453+
fn schedule_commands(&mut self) -> Option<ScheduleCommandQueue> {
454+
None
455+
}
454456

455457
fn initialize(&mut self, _world: &mut World) {}
456458

crates/bevy_ecs/src/schedule/stage.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use crate::{
55
BoxedRunCriteria, BoxedRunCriteriaLabel, BoxedSystemLabel, DuplicateLabelStrategy,
66
ExclusiveSystemContainer, GraphNode, InsertionPoint, ParallelExecutor,
77
ParallelSystemContainer, ParallelSystemExecutor, RunCriteriaContainer,
8-
RunCriteriaDescriptor, RunCriteriaDescriptorOrLabel, RunCriteriaInner,
9-
ShouldRun, SingleThreadedExecutor, SystemContainer, SystemDescriptor, SystemSet,
8+
RunCriteriaDescriptor, RunCriteriaDescriptorOrLabel, RunCriteriaInner, ShouldRun,
9+
SingleThreadedExecutor, SystemContainer, SystemDescriptor, SystemSet,
1010
},
11-
system::{System, ExclusiveSystem},
11+
system::{ExclusiveSystem, System},
1212
world::{World, WorldId},
1313
};
1414
use bevy_utils::{tracing::info, HashMap, HashSet};
@@ -809,7 +809,11 @@ impl Stage for SystemStage {
809809
)
810810
}
811811

812-
fn run_exclusive(world: &mut World, system: &mut Box<dyn ExclusiveSystem>, commands: &mut ScheduleCommandQueue) {
812+
fn run_exclusive(
813+
world: &mut World,
814+
system: &mut Box<dyn ExclusiveSystem>,
815+
commands: &mut ScheduleCommandQueue,
816+
) {
813817
system.run(world);
814818
if let Some(mut c) = system.schedule_commands() {
815819
c.transfer(commands);

crates/bevy_ecs/src/system/function_system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ use crate::{
22
archetype::{Archetype, ArchetypeComponentId, ArchetypeGeneration, ArchetypeId},
33
component::ComponentId,
44
query::{Access, FilteredAccessSet},
5+
schedule::ScheduleCommandQueue,
56
system::{
67
check_system_change_tick, ReadOnlySystemParamFetch, System, SystemId, SystemParam,
78
SystemParamFetch, SystemParamState,
89
},
910
world::{World, WorldId},
10-
schedule::ScheduleCommandQueue,
1111
};
1212
use bevy_ecs_macros::all_tuples;
1313
use std::{borrow::Cow, marker::PhantomData};

crates/bevy_ecs/src/system/system.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
use bevy_utils::tracing::warn;
22

3-
use crate::{archetype::{Archetype, ArchetypeComponentId}, component::ComponentId, query::Access, schedule::ScheduleCommandQueue, world::World};
3+
use crate::{
4+
archetype::{Archetype, ArchetypeComponentId},
5+
component::ComponentId,
6+
query::Access,
7+
schedule::ScheduleCommandQueue,
8+
world::World,
9+
};
410
use std::borrow::Cow;
511

612
/// A [`System`] identifier.

crates/bevy_ecs/src/system/system_param.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ pub unsafe trait SystemParamState: Send + Sync + 'static {
7272
fn new_archetype(&mut self, _archetype: &Archetype, _system_meta: &mut SystemMeta) {}
7373
#[inline]
7474
fn apply(&mut self, _world: &mut World) {}
75-
fn schedule_commands(&mut self) -> Option<ScheduleCommandQueue> { None }
75+
fn schedule_commands(&mut self) -> Option<ScheduleCommandQueue> {
76+
None
77+
}
7678
fn default_config() -> Self::Config;
7779
}
7880

0 commit comments

Comments
 (0)