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

Another follow-up to #31254

Release Notes:

- N/A
This commit is contained in:
Joseph T. Lyons
2025-05-26 23:04:31 -04:00
committed by GitHub
parent 4a577fff4a
commit c208532693
79 changed files with 319 additions and 306 deletions
+2 -2
View File
@@ -319,7 +319,7 @@ pub(crate) fn new_debugger_pane(
if let Some(tab) = dragged_item.downcast_ref::<DraggedTab>() {
let is_current_pane = tab.pane == cx.entity();
let Some(can_drag_away) = weak_running
.update(cx, |running_state, _| {
.read_with(cx, |running_state, _| {
let current_panes = running_state.panes.panes();
!current_panes.contains(&&tab.pane)
|| current_panes.len() > 1
@@ -952,7 +952,7 @@ impl RunningState {
let running = cx.entity();
let Ok(project) = self
.workspace
.update(cx, |workspace, _| workspace.project().clone())
.read_with(cx, |workspace, _| workspace.project().clone())
else {
return Task::ready(Err(anyhow!("no workspace")));
};
@@ -109,7 +109,7 @@ impl BreakpointList {
.update(cx, |this, cx| this.find_or_create_worktree(path, false, cx));
cx.spawn_in(window, async move |this, cx| {
let (worktree, relative_path) = task.await?;
let worktree_id = worktree.update(cx, |this, _| this.id())?;
let worktree_id = worktree.read_with(cx, |this, _| this.id())?;
let item = this
.update_in(cx, |this, window, cx| {
this.workspace.update(cx, |this, cx| {
@@ -280,7 +280,7 @@ impl StackFrameList {
})
})??
.await?;
let position = buffer.update(cx, |this, _| {
let position = buffer.read_with(cx, |this, _| {
this.snapshot().anchor_after(PointUtf16::new(row, 0))
})?;
this.update_in(cx, |this, window, cx| {