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:
@@ -171,7 +171,7 @@ impl SearchState {
|
||||
})
|
||||
.collect(),
|
||||
highlight_search_match_tx,
|
||||
_search_match_highlighter: cx.background_executor().spawn(async move {
|
||||
_search_match_highlighter: cx.background_spawn(async move {
|
||||
while let Ok(highlight_arguments) = highlight_search_match_rx.recv().await {
|
||||
let needs_init = highlight_arguments.search_data.get().is_none();
|
||||
let search_data = highlight_arguments.search_data.get_or_init(|| {
|
||||
@@ -681,8 +681,7 @@ impl OutlinePanel {
|
||||
mut cx: AsyncWindowContext,
|
||||
) -> anyhow::Result<Entity<Self>> {
|
||||
let serialized_panel = cx
|
||||
.background_executor()
|
||||
.spawn(async move { KEY_VALUE_STORE.read_kvp(OUTLINE_PANEL_KEY) })
|
||||
.background_spawn(async move { KEY_VALUE_STORE.read_kvp(OUTLINE_PANEL_KEY) })
|
||||
.await
|
||||
.context("loading outline panel")
|
||||
.log_err()
|
||||
@@ -849,7 +848,7 @@ impl OutlinePanel {
|
||||
fn serialize(&mut self, cx: &mut Context<Self>) {
|
||||
let width = self.width;
|
||||
let active = Some(self.active);
|
||||
self.pending_serialization = cx.background_executor().spawn(
|
||||
self.pending_serialization = cx.background_spawn(
|
||||
async move {
|
||||
KEY_VALUE_STORE
|
||||
.write_kvp(
|
||||
@@ -2631,8 +2630,7 @@ impl OutlinePanel {
|
||||
new_depth_map,
|
||||
new_children_count,
|
||||
)) = cx
|
||||
.background_executor()
|
||||
.spawn(async move {
|
||||
.background_spawn(async move {
|
||||
let mut processed_external_buffers = HashSet::default();
|
||||
let mut new_worktree_entries =
|
||||
BTreeMap::<WorktreeId, HashMap<ProjectEntryId, GitEntry>>::default();
|
||||
@@ -3224,8 +3222,7 @@ impl OutlinePanel {
|
||||
(buffer_id, excerpt_id),
|
||||
cx.spawn_in(window, |outline_panel, mut cx| async move {
|
||||
let fetched_outlines = cx
|
||||
.background_executor()
|
||||
.spawn(async move {
|
||||
.background_spawn(async move {
|
||||
buffer_snapshot
|
||||
.outline_items_containing(
|
||||
excerpt_range.context,
|
||||
|
||||
Reference in New Issue
Block a user