perf(key_left): remove clones
Selection access is mutable already. Operate on it directly.
This commit is contained in:
+5
-4
@@ -216,10 +216,11 @@ where
|
|||||||
/// Handles the left arrow key.
|
/// Handles the left arrow key.
|
||||||
/// Closes the currently selected or moves to its parent.
|
/// Closes the currently selected or moves to its parent.
|
||||||
pub fn key_left(&mut self) {
|
pub fn key_left(&mut self) {
|
||||||
let selected = self.selected();
|
// Reimplement self.close because of multiple different borrows
|
||||||
if !self.close(&selected) {
|
let changed = self.opened.remove(&self.selected);
|
||||||
let (head, _) = get_identifier_without_leaf(&selected);
|
if !changed {
|
||||||
self.select(head.to_vec());
|
// Select the parent by removing the leaf from selection
|
||||||
|
self.selected.pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user