Skip to content

Commit 45955c7

Browse files
authored
Use slice last instead of iter `last. (#22116)
# Objective - Followup to #22106. ## Solution - Use slice `last` instead of iter `last` for better performance - we don't need to iterate just to find the last element.
1 parent 82acdfd commit 45955c7

File tree

1 file changed

+2
-2
lines changed
  • crates/bevy_gltf/src/loader

1 file changed

+2
-2
lines changed

crates/bevy_gltf/src/loader/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ impl GltfLoader {
646646
for extension in extensions.iter_mut() {
647647
extension.on_texture(
648648
texture.extensions(),
649-
texture_handles.iter().last().unwrap().clone(),
649+
texture_handles.last().unwrap().clone(),
650650
);
651651
}
652652
}
@@ -684,7 +684,7 @@ impl GltfLoader {
684684
for extension in extensions.iter_mut() {
685685
extension.on_texture(
686686
extension_data.as_ref(),
687-
texture_handles.iter().last().unwrap().clone(),
687+
texture_handles.last().unwrap().clone(),
688688
);
689689
}
690690
}

0 commit comments

Comments
 (0)