Hide the implementation of Task
(#22009)
The `Option<T>` within `Ready` is confusing and using `None` for it can cause crashes. There was actually one instance of this! Release Notes: - N/A
This commit is contained in:
parent
1ac60289fe
commit
c5fe6ef100
6 changed files with 28 additions and 16 deletions
|
@ -9502,7 +9502,7 @@ impl Editor {
|
|||
let location_tasks = definitions
|
||||
.into_iter()
|
||||
.map(|definition| match definition {
|
||||
HoverLink::Text(link) => Task::Ready(Some(Ok(Some(link.target)))),
|
||||
HoverLink::Text(link) => Task::ready(Ok(Some(link.target))),
|
||||
HoverLink::InlayHint(lsp_location, server_id) => {
|
||||
editor.compute_target_location(lsp_location, server_id, cx)
|
||||
}
|
||||
|
@ -9544,7 +9544,7 @@ impl Editor {
|
|||
cx: &mut ViewContext<Self>,
|
||||
) -> Task<anyhow::Result<Option<Location>>> {
|
||||
let Some(project) = self.project.clone() else {
|
||||
return Task::Ready(Some(Ok(None)));
|
||||
return Task::ready(Ok(None));
|
||||
};
|
||||
|
||||
cx.spawn(move |editor, mut cx| async move {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue