Use read-only access methods for read-only entity operations (#31254)

This PR replaces some `update()` calls with either `read()` or
`read_with()` when the `update()` call performed read-only operations on
the entity.

Many more likely exist, will follow-up with more PRs.

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons
2025-05-23 06:13:49 -04:00
committed by GitHub
parent 508ccde363
commit f435304209
11 changed files with 20 additions and 20 deletions
@@ -326,7 +326,7 @@ async fn open_buffer(
workspace: &Entity<Workspace>,
cx: &mut gpui::VisualTestContext,
) -> Box<dyn ItemHandle> {
let project = workspace.update(cx, |workspace, _| workspace.project().clone());
let project = workspace.read_with(cx, |workspace, _| workspace.project().clone());
let worktree_id = project.update(cx, |project, cx| {
let worktree = project.worktrees(cx).last().expect("worktree not found");
worktree.read(cx).id()