@@ -131,6 +131,8 @@ The base-line performance cost of this algorithm comes from detecting changes, w
131
131
- `RemovedComponents<Parent>` is iterated once.
132
132
*/
133
133
134
+ #![ allow( clippy:: manual_map, clippy:: collapsible_match) ]
135
+
134
136
use crate :: view:: * ;
135
137
136
138
use crate :: prelude:: Camera ;
@@ -217,14 +219,14 @@ impl PropagateRenderGroups {
217
219
Self :: Camera => {
218
220
if !is_camera {
219
221
warn ! ( "failed propagating PropagateRenderGroups::Camera, {entity} doesn't have a camera" ) ;
220
- RenderGroupsRef :: Val ( RenderGroups :: empty ( ) ) ;
222
+ return RenderGroupsRef :: Val ( RenderGroups :: empty ( ) ) ;
221
223
} ;
222
224
RenderGroupsRef :: Val ( RenderGroups :: new_with_camera ( entity) )
223
225
}
224
226
Self :: CameraWithView => {
225
227
if !is_camera {
226
228
warn ! ( "failed propagating PropagateRenderGroups::CameraWithView, {entity} doesn't have a camera" ) ;
227
- RenderGroupsRef :: Val ( RenderGroups :: empty ( ) ) ;
229
+ return RenderGroupsRef :: Val ( RenderGroups :: empty ( ) ) ;
228
230
} ;
229
231
let empty_camera_view = CameraView :: empty ( ) ;
230
232
let view = view. unwrap_or ( & empty_camera_view) ;
@@ -233,7 +235,7 @@ impl PropagateRenderGroups {
233
235
// Reuse saved allocation.
234
236
let mut temp = RenderGroups :: default ( ) ;
235
237
std:: mem:: swap ( & mut temp, saved) ;
236
- temp. set_from_parts ( Some ( entity) , & view. layers ( ) ) ;
238
+ temp. set_from_parts ( Some ( entity) , view. layers ( ) ) ;
237
239
RenderGroupsRef :: Val ( temp)
238
240
} else {
239
241
// Allocate a new RenderGroups
@@ -255,7 +257,7 @@ impl PropagateRenderGroups {
255
257
///
256
258
/// ### Merge details
257
259
///
258
- /// The merge direction is ' entity_rendergroups.merge(propagated_rendergroups)`
260
+ /// The merge direction is ` entity_rendergroups.merge(propagated_rendergroups)`
259
261
/// (see [`RenderGroups::merge`]).
260
262
/// This means the entity's affiliated camera will be prioritized over the propagated affiliated camera.
261
263
#[ derive( Component , Debug , Clone ) ]
@@ -380,20 +382,21 @@ impl PropagateRenderGroupsEntityCache {
380
382
}
381
383
}
382
384
383
- /// Removes InheritedRenderGroups from entities with PropagateRenderGroups.
385
+ /// Removes ` InheritedRenderGroups` from entities with ` PropagateRenderGroups` .
384
386
fn clean_propagators (
385
387
mut commands : Commands ,
386
388
dirty_propagators : Query < Entity , ( With < InheritedRenderGroups > , With < PropagateRenderGroups > ) > ,
387
389
) {
388
390
for dirty in dirty_propagators. iter ( ) {
389
- commands. get_entity ( dirty) . map ( | mut e| {
390
- e . remove :: < InheritedRenderGroups > ( ) ;
391
- } ) ;
391
+ if let Some ( mut entity ) = commands. get_entity ( dirty) {
392
+ entity . remove :: < InheritedRenderGroups > ( ) ;
393
+ }
392
394
}
393
395
}
394
396
395
397
/// Propagates propagation values that have changed.
396
398
//todo: Detect if the propagated value has actually changed? Hard to expect this would matter in practice.
399
+ #[ allow( clippy:: too_many_arguments) ]
397
400
fn propagate_updated_propagators (
398
401
mut commands : Commands ,
399
402
mut updated_entities : ResMut < PropagateRenderGroupsEntityCache > ,
@@ -677,7 +680,7 @@ fn apply_new_children_propagation(
677
680
}
678
681
}
679
682
680
- /// Removes InheritedRenderGroups from orphaned branches of the hierarchy.
683
+ /// Removes ` InheritedRenderGroups` from orphaned branches of the hierarchy.
681
684
fn handle_orphaned_nonpropagators (
682
685
mut commands : Commands ,
683
686
mut updated_entities : ResMut < PropagateRenderGroupsEntityCache > ,
@@ -714,9 +717,9 @@ fn apply_orphan_cleanup(
714
717
maybe_children : Option < & Children > ,
715
718
) {
716
719
// Remove InheritedRenderGroups.
717
- commands. get_entity ( entity) . map ( | mut e| {
718
- e . remove :: < InheritedRenderGroups > ( ) ;
719
- } ) ;
720
+ if let Some ( mut entity ) = commands. get_entity ( entity) {
721
+ entity . remove :: < InheritedRenderGroups > ( ) ;
722
+ }
720
723
721
724
// Mark as updated.
722
725
updated_entities. insert ( entity) ;
@@ -741,7 +744,7 @@ fn apply_orphan_cleanup(
741
744
}
742
745
}
743
746
744
- /// Handles entities that lost the PropagateRenderGroups component.
747
+ /// Handles entities that lost the ` PropagateRenderGroups` component.
745
748
fn handle_lost_propagator (
746
749
mut commands : Commands ,
747
750
mut updated_entities : ResMut < PropagateRenderGroupsEntityCache > ,
@@ -951,7 +954,7 @@ fn apply_full_propagation_force_update(
951
954
}
952
955
}
953
956
954
- /// Applies InheritedRenderGroups removal to entities for `handle_lost_propagator`,
957
+ /// Applies ` InheritedRenderGroups` removal to entities for `handle_lost_propagator`,
955
958
/// `handle_new_children_nonpropagator`, and `handle_new_parent_nonpropagator`.
956
959
fn apply_full_propagation_force_remove (
957
960
commands : & mut Commands ,
@@ -994,7 +997,7 @@ fn apply_full_propagation_force_remove(
994
997
}
995
998
}
996
999
997
- /// Handles non-propagator entities with InheritedRenderGroups whose children changed.
1000
+ /// Handles non-propagator entities with ` InheritedRenderGroups` whose children changed.
998
1001
fn handle_new_children_nonpropagator (
999
1002
mut commands : Commands ,
1000
1003
mut updated_entities : ResMut < PropagateRenderGroupsEntityCache > ,
@@ -1089,12 +1092,12 @@ fn handle_new_children_nonpropagator(
1089
1092
}
1090
1093
}
1091
1094
1092
- /// Handles non-propagator entities with InheritedRenderGroups whose parents changed.
1093
- /// - Since handle_new_children_nonpropagator handles all cases where the parent has InheritedRenderGroups, this
1094
- /// system just needs to remove InheritedRenderGroups from non-updated entities and their non-updated descendents
1095
- /// that have InheritedRenderGroups (stopping at propagators and non-updated descendents without
1096
- /// InheritedRenderGroups).
1097
- /// - We skip non-updated entities whose parents are updated, because that implies the current InheritedRenderGroups
1095
+ /// Handles non-propagator entities with ` InheritedRenderGroups` whose parents changed.
1096
+ /// - Since ` handle_new_children_nonpropagator` handles all cases where the parent has ` InheritedRenderGroups` , this
1097
+ /// system just needs to remove ` InheritedRenderGroups` from non-updated entities and their non-updated descendents
1098
+ /// that have ` InheritedRenderGroups` (stopping at propagators and non-updated descendents without
1099
+ /// ` InheritedRenderGroups` ).
1100
+ /// - We skip non-updated entities whose parents are updated, because that implies the current ` InheritedRenderGroups`
1098
1101
/// propagator is accurate.
1099
1102
fn handle_new_parent_nonpropagator (
1100
1103
mut commands : Commands ,
@@ -1151,7 +1154,7 @@ fn handle_new_parent_nonpropagator(
1151
1154
}
1152
1155
}
1153
1156
1154
- /// Handles added/removed/changed RenderGroups for entities with existing InheritedRenderGroups.
1157
+ /// Handles added/removed/changed ` RenderGroups` for entities with existing ` InheritedRenderGroups` .
1155
1158
fn handle_modified_rendergroups (
1156
1159
mut updated_entities : ResMut < PropagateRenderGroupsEntityCache > ,
1157
1160
// Entities with InheritedRenderGroups that changed RenderGroups
0 commit comments