assistant2: Small misc efficiency improvements (#22947)

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-01-10 02:20:15 -07:00 committed by GitHub
parent 767f44bd27
commit 690ad29ba9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 16 deletions

View file

@ -191,22 +191,20 @@ impl ContextStore {
collect_files_in_path(worktree, &project_path.path)
})?;
let open_buffer_tasks = project.update(&mut cx, |project, cx| {
files
.iter()
.map(|file_path| {
project.open_buffer(
ProjectPath {
worktree_id,
path: file_path.clone(),
},
cx,
)
})
.collect::<Vec<_>>()
let open_buffers_task = project.update(&mut cx, |project, cx| {
let tasks = files.iter().map(|file_path| {
project.open_buffer(
ProjectPath {
worktree_id,
path: file_path.clone(),
},
cx,
)
});
future::join_all(tasks)
})?;
let buffers = future::join_all(open_buffer_tasks).await;
let buffers = open_buffers_task.await;
let mut buffer_infos = Vec::new();
let mut text_tasks = Vec::new();