Fix warnings/errors now that AsyncAppContext::update returns Result

This commit is contained in:
Antonio Scandurra 2023-04-18 14:58:57 +02:00
parent 31e6bb4fc1
commit d03c431f9a
33 changed files with 494 additions and 371 deletions

View file

@ -131,16 +131,21 @@ impl SerializedPaneGroup {
))
}
SerializedPaneGroup::Pane(serialized_pane) => {
let pane = workspace.update(cx, |workspace, cx| workspace.add_pane(cx))?;
let pane = workspace
.update(cx, |workspace, cx| workspace.add_pane(cx))
.log_err()?;
let active = serialized_pane.active;
serialized_pane
.deserialize_to(project, &pane, workspace_id, workspace, cx)
.await;
.await
.log_err()?;
if pane.read_with(cx, |pane, _| pane.items_len() != 0) {
Some((Member::Pane(pane.clone()), active.then(|| pane)))
} else {
workspace.update(cx, |workspace, cx| workspace.remove_pane(pane, cx));
workspace
.update(cx, |workspace, cx| workspace.remove_pane(pane, cx))
.log_err()?;
None
}
}
@ -166,7 +171,7 @@ impl SerializedPane {
workspace_id: WorkspaceId,
workspace: &ViewHandle<Workspace>,
cx: &mut AsyncAppContext,
) -> Option<()> {
) -> Result<()> {
let mut active_item_index = None;
for (index, item) in self.children.iter().enumerate() {
let project = project.clone();
@ -193,7 +198,7 @@ impl SerializedPane {
if let Some(item_handle) = item_handle {
workspace.update(cx, |workspace, cx| {
Pane::add_item(workspace, &pane_handle, item_handle, false, false, None, cx);
});
})?;
}
if item.active {
@ -207,7 +212,7 @@ impl SerializedPane {
})?;
}
Some(())
anyhow::Ok(())
}
}