@@ -8,7 +8,6 @@ use futures_util::stream::{FuturesUnordered, StreamExt};
8pub enum Callback {
8pub enum Callback {
9 EditorCompositor(Box<dyn FnOnce(&mut Editor, &mut Compositor) + Send>),
9 EditorCompositor(Box<dyn FnOnce(&mut Editor, &mut Compositor) + Send>),
10 Editor(Box<dyn FnOnce(&mut Editor) + Send>),
10 Editor(Box<dyn FnOnce(&mut Editor) + Send>),
11− Compositor(Box<dyn FnOnce(&mut Compositor) + Send>),
14pub type JobFuture = BoxFuture<'static, anyhow::Result<Option<Callback>>>;
13pub type JobFuture = BoxFuture<'static, anyhow::Result<Option<Callback>>>;
@@ -76,7 +75,6 @@ impl Jobs {
76 Ok(Some(call)) => match call {
75 Ok(Some(call)) => match call {
77 Callback::EditorCompositor(call) => call(editor, compositor),
76 Callback::EditorCompositor(call) => call(editor, compositor),
78 Callback::Editor(call) => call(editor),
77 Callback::Editor(call) => call(editor),
79− Callback::Compositor(call) => call(compositor),
81 Err(e) => {
79 Err(e) => {
82 editor.set_error(format!("Async job failed: {}", e));
80 editor.set_error(format!("Async job failed: {}", e));
@@ -102,7 +100,7 @@ impl Jobs {
102 /// Blocks until all the jobs that need to be waited on are done.
100 /// Blocks until all the jobs that need to be waited on are done.
103 pub async fn finish(
101 pub async fn finish(
104 &mut self,
102 &mut self,
105− mut editor: Option<&mut Editor>,
103+ editor: &mut Editor,
106 mut compositor: Option<&mut Compositor>,
104 mut compositor: Option<&mut Compositor>,
107 ) -> anyhow::Result<()> {
105 ) -> anyhow::Result<()> {
108 log::debug!("waiting on jobs...");
106 log::debug!("waiting on jobs...");
@@ -117,20 +115,10 @@ impl Jobs {
117 // clippy doesn't realize this is an error without the derefs
115 // clippy doesn't realize this is an error without the derefs
118 #[allow(clippy::needless_option_as_deref)]
116 #[allow(clippy::needless_option_as_deref)]
119 match callback {
117 match callback {
120− Callback::EditorCompositor(call)
118+ Callback::EditorCompositor(call) if compositor.is_some() => {
121− if editor.is_some() && compositor.is_some() =>
124− editor.as_deref_mut().unwrap(),
125− compositor.as_deref_mut().unwrap(),
128− Callback::Editor(call) if editor.is_some() => {
129− call(editor.as_deref_mut().unwrap())
131− Callback::Compositor(call) if compositor.is_some() => {
132− call(compositor.as_deref_mut().unwrap())
119+ call(editor, compositor.as_deref_mut().unwrap())
121+ Callback::Editor(call) => call(editor),
135 // skip callbacks for which we don't have the necessary references
123 // skip callbacks for which we don't have the necessary references