Skip to content

Commit

Permalink
used retain instead of putting in heap
Browse files Browse the repository at this point in the history
  • Loading branch information
0SlowPoke0 authored and Keavon committed Nov 21, 2024
1 parent 350503f commit c480ae5
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1607,12 +1607,9 @@ impl NodeNetworkInterface {
return;
};

let mut non_empty_selections:VecDeque<SelectedNodes> = network_metadata.persistent_metadata.selection_redo_history.iter().
filter(|selected_nodes| selected_nodes.has_selected_nodes()).
cloned().
collect();
network_metadata.persistent_metadata.selection_redo_history.retain(|selected_nodes| selected_nodes.has_selected_nodes());

if let Some(selection_state) = non_empty_selections.pop_back() {
if let Some(selection_state) = network_metadata.persistent_metadata.selection_redo_history.pop_back() {
network_metadata.persistent_metadata.selection_redo_history.push_front(selection_state);
}
}
Expand All @@ -1623,12 +1620,9 @@ impl NodeNetworkInterface {
return;
};

let mut non_empty_selections:VecDeque<SelectedNodes> = network_metadata.persistent_metadata.selection_redo_history.iter().
filter(|selected_nodes| selected_nodes.has_selected_nodes()).
cloned().
collect();
network_metadata.persistent_metadata.selection_redo_history.retain(|selected_nodes| selected_nodes.has_selected_nodes());

if let Some(selection_state) = non_empty_selections.pop_front() {
if let Some(selection_state) = network_metadata.persistent_metadata.selection_redo_history.pop_front() {
network_metadata.persistent_metadata.selection_undo_history.push_back(selection_state);
}
}
Expand Down

0 comments on commit c480ae5

Please sign in to comment.