From d322704f251c49e08c393ab3057ad945623b2806 Mon Sep 17 00:00:00 2001 From: hypercube <0hypercube@gmail.com> Date: Mon, 16 Dec 2024 21:47:00 +0000 Subject: [PATCH] Reduce allocations --- .../portfolio/document/utility_types/network_interface.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editor/src/messages/portfolio/document/utility_types/network_interface.rs b/editor/src/messages/portfolio/document/utility_types/network_interface.rs index 31e0847676..7eaab70df5 100644 --- a/editor/src/messages/portfolio/document/utility_types/network_interface.rs +++ b/editor/src/messages/portfolio/document/utility_types/network_interface.rs @@ -1595,10 +1595,10 @@ impl NodeNetworkInterface { network_metadata.persistent_metadata.selection_undo_history.back().cloned().unwrap_or_default() }; - let layers_except_artboards: Vec<_> = last_selection_state.selected_layers_except_artboards(self).collect(); + let is_selection_empty = last_selection_state.selected_layers_except_artboards(self).next().is_none(); // If the selection is empty or contains only artboards, skip the undo history update. - if layers_except_artboards.is_empty() { + if is_selection_empty { let Some(network_metadata) = self.network_metadata_mut(network_path) else { log::error!("Could not get nested network_metadata in selected_nodes"); return None;