Skip to content

Commit 310e46c

Browse files
committed
Address comments.
1 parent cc47e7b commit 310e46c

File tree

2 files changed

+23
-55
lines changed

2 files changed

+23
-55
lines changed

crates/bevy_ecs/src/schedule/executor_parallel.rs

+22-54
Original file line numberDiff line numberDiff line change
@@ -325,16 +325,17 @@ mod scheduling_event {
325325
#[cfg(test)]
326326
#[cfg(test)]
327327
mod tests {
328-
use super::scheduling_event::*;
329328
use crate::{
330-
schedule::{SingleThreadedExecutor, Stage, SystemStage},
331-
system::{NonSend, Query, Res, ResMut},
329+
self as bevy_ecs,
330+
component::Component,
331+
schedule::{
332+
executor_parallel::scheduling_event::*, SingleThreadedExecutor, Stage, SystemStage,
333+
},
334+
system::{NonSend, Query, Res, ResMut, Resource},
332335
world::World,
333336
};
334337

335-
use crate as bevy_ecs;
336-
use crate::component::Component;
337-
use crate::system::Resource;
338+
use SchedulingEvent::StartedSystems;
338339

339340
#[derive(Component)]
340341
struct W<T>(T);
@@ -361,10 +362,7 @@ mod tests {
361362
stage.run(&mut world);
362363
assert_eq!(
363364
receive_events(&world),
364-
vec![
365-
SchedulingEvent::StartedSystems(3),
366-
SchedulingEvent::StartedSystems(3),
367-
]
365+
vec![StartedSystems(3), StartedSystems(3),]
368366
);
369367
}
370368

@@ -380,30 +378,21 @@ mod tests {
380378
stage.run(&mut world);
381379
assert_eq!(
382380
receive_events(&world),
383-
vec![
384-
SchedulingEvent::StartedSystems(1),
385-
SchedulingEvent::StartedSystems(1),
386-
]
381+
vec![StartedSystems(1), StartedSystems(1),]
387382
);
388383
let mut stage = SystemStage::parallel()
389384
.with_system(wants_mut)
390385
.with_system(wants_ref);
391386
stage.run(&mut world);
392387
assert_eq!(
393388
receive_events(&world),
394-
vec![
395-
SchedulingEvent::StartedSystems(1),
396-
SchedulingEvent::StartedSystems(1),
397-
]
389+
vec![StartedSystems(1), StartedSystems(1),]
398390
);
399391
let mut stage = SystemStage::parallel()
400392
.with_system(wants_ref)
401393
.with_system(wants_ref);
402394
stage.run(&mut world);
403-
assert_eq!(
404-
receive_events(&world),
405-
vec![SchedulingEvent::StartedSystems(2),]
406-
);
395+
assert_eq!(receive_events(&world), vec![StartedSystems(2),]);
407396
}
408397

409398
#[test]
@@ -418,30 +407,21 @@ mod tests {
418407
stage.run(&mut world);
419408
assert_eq!(
420409
receive_events(&world),
421-
vec![
422-
SchedulingEvent::StartedSystems(1),
423-
SchedulingEvent::StartedSystems(1),
424-
]
410+
vec![StartedSystems(1), StartedSystems(1),]
425411
);
426412
let mut stage = SystemStage::parallel()
427413
.with_system(wants_mut)
428414
.with_system(wants_ref);
429415
stage.run(&mut world);
430416
assert_eq!(
431417
receive_events(&world),
432-
vec![
433-
SchedulingEvent::StartedSystems(1),
434-
SchedulingEvent::StartedSystems(1),
435-
]
418+
vec![StartedSystems(1), StartedSystems(1),]
436419
);
437420
let mut stage = SystemStage::parallel()
438421
.with_system(wants_ref)
439422
.with_system(wants_ref);
440423
stage.run(&mut world);
441-
assert_eq!(
442-
receive_events(&world),
443-
vec![SchedulingEvent::StartedSystems(2),]
444-
);
424+
assert_eq!(receive_events(&world), vec![StartedSystems(2),]);
445425
let mut world = World::new();
446426
world.spawn().insert_bundle((W(0usize), W(0u32), W(0f32)));
447427
fn wants_mut_usize(_: Query<(&mut W<usize>, &W<f32>)>) {}
@@ -450,10 +430,7 @@ mod tests {
450430
.with_system(wants_mut_usize)
451431
.with_system(wants_mut_u32);
452432
stage.run(&mut world);
453-
assert_eq!(
454-
receive_events(&world),
455-
vec![SchedulingEvent::StartedSystems(2),]
456-
);
433+
assert_eq!(receive_events(&world), vec![StartedSystems(2),]);
457434
}
458435

459436
#[test]
@@ -468,30 +445,21 @@ mod tests {
468445
stage.run(&mut world);
469446
assert_eq!(
470447
receive_events(&world),
471-
vec![
472-
SchedulingEvent::StartedSystems(1),
473-
SchedulingEvent::StartedSystems(1),
474-
]
448+
vec![StartedSystems(1), StartedSystems(1),]
475449
);
476450
let mut stage = SystemStage::parallel()
477451
.with_system(wants_mut)
478452
.with_system(wants_world);
479453
stage.run(&mut world);
480454
assert_eq!(
481455
receive_events(&world),
482-
vec![
483-
SchedulingEvent::StartedSystems(1),
484-
SchedulingEvent::StartedSystems(1),
485-
]
456+
vec![StartedSystems(1), StartedSystems(1),]
486457
);
487458
let mut stage = SystemStage::parallel()
488459
.with_system(wants_world)
489460
.with_system(wants_world);
490461
stage.run(&mut world);
491-
assert_eq!(
492-
receive_events(&world),
493-
vec![SchedulingEvent::StartedSystems(2),]
494-
);
462+
assert_eq!(receive_events(&world), vec![StartedSystems(2),]);
495463
}
496464

497465
#[test]
@@ -514,10 +482,10 @@ mod tests {
514482
assert_eq!(
515483
receive_events(&world),
516484
vec![
517-
SchedulingEvent::StartedSystems(3),
518-
SchedulingEvent::StartedSystems(1),
519-
SchedulingEvent::StartedSystems(1),
520-
SchedulingEvent::StartedSystems(1),
485+
StartedSystems(3),
486+
StartedSystems(1),
487+
StartedSystems(1),
488+
StartedSystems(1),
521489
]
522490
);
523491
stage.set_executor(Box::new(SingleThreadedExecutor::default()));

crates/bevy_pbr/src/material.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ impl<M: Material> Default for ExtractedMaterials<M> {
453453

454454
/// Stores all prepared representations of [`Material`] assets for as long as they exist.
455455
#[derive(Resource, Deref, DerefMut)]
456-
pub struct RenderMaterials<T: Material>(HashMap<Handle<T>, PreparedMaterial<T>>);
456+
pub struct RenderMaterials<T: Material>(pub HashMap<Handle<T>, PreparedMaterial<T>>);
457457

458458
impl<T: Material> Default for RenderMaterials<T> {
459459
fn default() -> Self {

0 commit comments

Comments
 (0)