perf(key_left): remove clones

Selection access is mutable already. Operate on it directly.
This commit is contained in:
EdJoPaTo
2024-01-26 05:22:20 +01:00
parent d1a241266f
commit 632a95f853
+5 -4
View File
@@ -216,10 +216,11 @@ where
/// Handles the left arrow key.
/// Closes the currently selected or moves to its parent.
pub fn key_left(&mut self) {
let selected = self.selected();
if !self.close(&selected) {
let (head, _) = get_identifier_without_leaf(&selected);
self.select(head.to_vec());
// Reimplement self.close because of multiple different borrows
let changed = self.opened.remove(&self.selected);
if !changed {
// Select the parent by removing the leaf from selection
self.selected.pop();
}
}