Add FilteredAccess::empty and simplify the implementatin of update_component_access for AnyOf/Or#14352
Conversation
9d814d4 to
a7b3a88
Compare
chescock
left a comment
There was a problem hiding this comment.
This makes those implementations much clearer!
2291bf7 to
2a23d74
Compare
Guvante
left a comment
There was a problem hiding this comment.
Does this change the behavior of Or<()>? The old code seems to be a no-op while the new code seems to remove all filter_sets. Mostly from a breaking changes standpoint.
Yes, this is already mentioned in the migration guide. I could avoid this breaking change by adding a bit of complexity in the code, but the current behaviour seems wrong to me so this is also an occasion to fix it. |
Objective
update_component_accessforAnyOf/Oris kinda weird due to special casing the first filter, let's simplify it;FilteredAccessvalue corresponding to FALSE and thus the only option was reducing, which special cases the first element as being the initial accumulator.This is an alternative to #14026
Solution
FilteredAccess::emptyas a way to create aFilteredAccesscorresponding to the logical proposition FALSE;Migration Guide
AnyOf<()>andOr<()>has been changed to match no archetypes rather than all archetypes to naturally match the corresponding logical operation. Consider replacing them with()instead.