Explicit using clone_from (#14670)

# Objective

- after #14502 ,explicit using clone_from should has better performance
because it could reuse the resources to avoid unnecessary allocations.
This commit is contained in:
re0312 2024-08-09 22:17:13 +08:00 committed by GitHub
parent e14f3cf402
commit 66bf160ec5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -633,7 +633,7 @@ unsafe impl<'a> WorldQuery for FilteredEntityRef<'a> {
#[inline]
fn set_access<'w>(state: &mut Self::State, access: &FilteredAccess<ComponentId>) {
*state = access.clone();
state.clone_from(access);
state.access_mut().clear_writes();
}
@ -746,7 +746,7 @@ unsafe impl<'a> WorldQuery for FilteredEntityMut<'a> {
#[inline]
fn set_access<'w>(state: &mut Self::State, access: &FilteredAccess<ComponentId>) {
*state = access.clone();
state.clone_from(access);
}
#[inline(always)]