From f274a6ab4f981e28e8167a727fc064d646cd7c18 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Mon, 28 Mar 2022 17:47:14 +0200 Subject: [PATCH] Avoid unnecessary clones when undoing/redoing selections --- crates/editor/src/editor.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 7f771f26e8..f861b6ac60 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -4421,9 +4421,9 @@ impl Editor { self.end_selection(cx); self.selection_history.mode = SelectionHistoryMode::Undoing; if let Some(entry) = self.selection_history.undo_stack.pop_back() { - self.set_selections(entry.selections.clone(), None, true, cx); - self.select_next_state = entry.select_next_state.clone(); - self.add_selections_state = entry.add_selections_state.clone(); + self.set_selections(entry.selections, None, true, cx); + self.select_next_state = entry.select_next_state; + self.add_selections_state = entry.add_selections_state; self.request_autoscroll(Autoscroll::Newest, cx); } self.selection_history.mode = SelectionHistoryMode::Normal; @@ -4433,9 +4433,9 @@ impl Editor { self.end_selection(cx); self.selection_history.mode = SelectionHistoryMode::Redoing; if let Some(entry) = self.selection_history.redo_stack.pop_back() { - self.set_selections(entry.selections.clone(), None, true, cx); - self.select_next_state = entry.select_next_state.clone(); - self.add_selections_state = entry.add_selections_state.clone(); + self.set_selections(entry.selections, None, true, cx); + self.select_next_state = entry.select_next_state; + self.add_selections_state = entry.add_selections_state; self.request_autoscroll(Autoscroll::Newest, cx); } self.selection_history.mode = SelectionHistoryMode::Normal;