mirror of https://github.com/lapce/lapce.git
Rewritten a loop-based variable to the more idiomatic iterator-based implementation (#1463)
This commit is contained in:
parent
7235c3a577
commit
d45b4f9c5c
|
@ -3361,12 +3361,11 @@ pub fn widget_close(
|
||||||
editor_tab_id: WidgetId,
|
editor_tab_id: WidgetId,
|
||||||
) {
|
) {
|
||||||
let editor_tab = self.editor_tabs.get(&editor_tab_id).unwrap();
|
let editor_tab = self.editor_tabs.get(&editor_tab_id).unwrap();
|
||||||
let mut index = 0;
|
let index = editor_tab
|
||||||
for (i, child) in editor_tab.children.iter().enumerate() {
|
.children
|
||||||
if child.widget_id() == widget_id {
|
.iter()
|
||||||
index = i;
|
.position(|child| child.widget_id() == widget_id)
|
||||||
}
|
.unwrap_or(0);
|
||||||
}
|
|
||||||
ctx.submit_command(Command::new(
|
ctx.submit_command(Command::new(
|
||||||
LAPCE_UI_COMMAND,
|
LAPCE_UI_COMMAND,
|
||||||
LapceUICommand::EditorTabRemove(index, true, true),
|
LapceUICommand::EditorTabRemove(index, true, true),
|
||||||
|
|
Loading…
Reference in New Issue