wip: refactor

This commit is contained in:
2024-12-16 08:53:55 +07:00
parent 2b9c88c5b7
commit 377f169420
16 changed files with 245 additions and 1381 deletions

View File

@@ -81,7 +81,7 @@ pub trait DropdownDelegate: Sized {
}
fn perform_search(&mut self, _query: &str, _cx: &mut ViewContext<Dropdown<Self>>) -> Task<()> {
Task::Ready(Some(()))
Task::ready(())
}
}
@@ -178,11 +178,9 @@ where
}
fn perform_search(&mut self, query: &str, cx: &mut ViewContext<List<Self>>) -> Task<()> {
self.dropdown
.upgrade()
.map_or(Task::Ready(None), |dropdown| {
dropdown.update(cx, |_, cx| self.delegate.perform_search(query, cx))
})
self.dropdown.upgrade().map_or(Task::ready(()), |dropdown| {
dropdown.update(cx, |_, cx| self.delegate.perform_search(query, cx))
})
}
fn set_selected_index(&mut self, ix: Option<usize>, _: &mut ViewContext<List<Self>>) {
@@ -285,7 +283,7 @@ impl<T: DropdownItem + Clone> DropdownDelegate for SearchableVec<T> {
.cloned()
.collect();
Task::Ready(Some(()))
Task::ready(())
}
}