From 12fe64b1774a7650440be1da3f3ceae96041f8f8 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Mon, 25 Dec 2023 07:02:19 -0500 Subject: [PATCH] Fix more warnings --- crates/zed2/src/main.rs | 91 +++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 48 deletions(-) diff --git a/crates/zed2/src/main.rs b/crates/zed2/src/main.rs index f1fd168ffd..8ddce12f99 100644 --- a/crates/zed2/src/main.rs +++ b/crates/zed2/src/main.rs @@ -250,7 +250,7 @@ fn main() { cx: &mut AppContext, ) { let task = workspace::open_paths(&paths, &app_state, None, cx); - cx.spawn(|cx| async move { + cx.spawn(|_| async move { if let Some((_window, results)) = task.await.log_err() { for result in results { if let Some(Err(e)) = result { @@ -311,53 +311,48 @@ fn main() { } let app_state = app_state.clone(); - let closure_client = client.clone(); - cx.spawn(move |mut cx| { - let client = closure_client.clone(); - async move { - while let Some(request) = open_rx.next().await { - match request { - OpenRequest::Paths { paths } => { - cx.update(|cx| open_paths_and_log_errs(&paths, &app_state, cx)) - .ok(); - } - OpenRequest::CliConnection { connection } => { - let app_state = app_state.clone(); - cx.spawn(move |cx| { - handle_cli_connection(connection, app_state.clone(), cx) - }) - .detach(); - } - OpenRequest::JoinChannel { channel_id } => { - let app_state = app_state.clone(); - cx.update(|mut cx| { - cx.spawn(|cx| async move { - cx.update(|cx| { - workspace::join_channel(channel_id, app_state, None, cx) - })? - .await?; - anyhow::Ok(()) - }) - .detach_and_log_err(&mut cx); - }) - .log_err(); - } - OpenRequest::OpenChannelNotes { channel_id } => { - let app_state = app_state.clone(); - let open_notes_task = cx.spawn(|mut cx| async move { - let workspace_window = - workspace::get_any_active_workspace(app_state, cx.clone()) - .await?; - let _ = workspace_window - .update(&mut cx, |_, cx| { - ChannelView::open(channel_id, cx.view().clone(), cx) - })? - .await?; + cx.spawn(move |cx| async move { + while let Some(request) = open_rx.next().await { + match request { + OpenRequest::Paths { paths } => { + cx.update(|cx| open_paths_and_log_errs(&paths, &app_state, cx)) + .ok(); + } + OpenRequest::CliConnection { connection } => { + let app_state = app_state.clone(); + cx.spawn(move |cx| { + handle_cli_connection(connection, app_state.clone(), cx) + }) + .detach(); + } + OpenRequest::JoinChannel { channel_id } => { + let app_state = app_state.clone(); + cx.update(|mut cx| { + cx.spawn(|cx| async move { + cx.update(|cx| { + workspace::join_channel(channel_id, app_state, None, cx) + })? + .await?; anyhow::Ok(()) - }); - cx.update(|cx| open_notes_task.detach_and_log_err(cx)) - .log_err(); - } + }) + .detach_and_log_err(&mut cx); + }) + .log_err(); + } + OpenRequest::OpenChannelNotes { channel_id } => { + let app_state = app_state.clone(); + let open_notes_task = cx.spawn(|mut cx| async move { + let workspace_window = + workspace::get_any_active_workspace(app_state, cx.clone()).await?; + let _ = workspace_window + .update(&mut cx, |_, cx| { + ChannelView::open(channel_id, cx.view().clone(), cx) + })? + .await?; + anyhow::Ok(()) + }); + cx.update(|cx| open_notes_task.detach_and_log_err(cx)) + .log_err(); } } } @@ -773,7 +768,7 @@ async fn watch_languages(fs: Arc, languages: Arc) fn watch_file_types(fs: Arc, cx: &mut AppContext) { use std::time::Duration; - cx.spawn(|mut cx| async move { + cx.spawn(|cx| async move { let mut events = fs .watch( "assets/icons/file_icons/file_types.json".as_ref(),