cx.background_executor().spawn(...) -> cx.background_spawn(...) (#25103)

Done automatically with

> ast-grep -p '$A.background_executor().spawn($B)' -r
'$A.background_spawn($B)' --update-all --globs "\!crates/gpui"

Followed by:

* `cargo fmt`
* Unexpected need to remove some trailing whitespace.
* Manually adding imports of `gpui::{AppContext as _}` which provides
`background_spawn`
* Added `AppContext as _` to existing use of `AppContext`

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-02-18 13:30:33 -07:00 committed by GitHub
parent f606b0641e
commit b1872e3afd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
120 changed files with 1146 additions and 1267 deletions

View file

@ -5,7 +5,7 @@ use crate::{
use call::{RemoteVideoTrack, RemoteVideoTrackView};
use client::{proto::PeerId, User};
use gpui::{
div, AppContext, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement,
div, AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement,
ParentElement, Render, SharedString, Styled,
};
use std::sync::Arc;

View file

@ -4337,8 +4337,7 @@ impl Workspace {
self.update_active_view_for_followers(window, cx);
if let Some(database_id) = self.database_id {
cx.background_executor()
.spawn(persistence::DB.update_timestamp(database_id))
cx.background_spawn(persistence::DB.update_timestamp(database_id))
.detach();
}
} else {
@ -4626,8 +4625,7 @@ impl Workspace {
if let Ok(Some(task)) = this.update_in(cx, |workspace, window, cx| {
item.serialize(workspace, false, window, cx)
}) {
cx.background_executor()
.spawn(async move { task.await.log_err() })
cx.background_spawn(async move { task.await.log_err() })
.detach();
}
}
@ -4965,8 +4963,7 @@ impl Workspace {
) {
self.centered_layout = !self.centered_layout;
if let Some(database_id) = self.database_id() {
cx.background_executor()
.spawn(DB.set_centered_layout(database_id, self.centered_layout))
cx.background_spawn(DB.set_centered_layout(database_id, self.centered_layout))
.detach_and_log_err(cx);
}
cx.notify();
@ -6223,7 +6220,7 @@ fn serialize_ssh_project(
Option<SerializedWorkspace>,
)>,
> {
cx.background_executor().spawn(async move {
cx.background_spawn(async move {
let serialized_ssh_project = persistence::DB
.get_or_create_ssh_project(
connection_options.host.clone(),