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:
parent
4a577fff4a
commit
c208532693
79 changed files with 319 additions and 306 deletions
|
@ -880,7 +880,7 @@ impl Worktree {
|
|||
.await
|
||||
.map(CreatedEntry::Included),
|
||||
None => {
|
||||
let abs_path = this.update(cx, |worktree, _| {
|
||||
let abs_path = this.read_with(cx, |worktree, _| {
|
||||
worktree
|
||||
.absolutize(&path)
|
||||
.with_context(|| format!("absolutizing {path:?}"))
|
||||
|
@ -2027,7 +2027,7 @@ impl LocalWorktree {
|
|||
cx.spawn(async move |this, cx| {
|
||||
refresh.recv().await;
|
||||
log::trace!("refreshed entry {path:?} in {:?}", t0.elapsed());
|
||||
let new_entry = this.update(cx, |this, _| {
|
||||
let new_entry = this.read_with(cx, |this, _| {
|
||||
this.entry_for_path(path)
|
||||
.cloned()
|
||||
.context("reading path after update")
|
||||
|
@ -2274,7 +2274,7 @@ impl RemoteWorktree {
|
|||
.await
|
||||
.map(CreatedEntry::Included),
|
||||
None => {
|
||||
let abs_path = this.update(cx, |worktree, _| {
|
||||
let abs_path = this.read_with(cx, |worktree, _| {
|
||||
worktree
|
||||
.absolutize(&new_path)
|
||||
.with_context(|| format!("absolutizing {new_path:?}"))
|
||||
|
@ -5082,7 +5082,7 @@ impl WorktreeModelHandle for Entity<Worktree> {
|
|||
let file_name = "fs-event-sentinel";
|
||||
|
||||
let tree = self.clone();
|
||||
let (fs, root_path) = self.update(cx, |tree, _| {
|
||||
let (fs, root_path) = self.read_with(cx, |tree, _| {
|
||||
let tree = tree.as_local().unwrap();
|
||||
(tree.fs.clone(), tree.abs_path().clone())
|
||||
});
|
||||
|
@ -5094,7 +5094,7 @@ impl WorktreeModelHandle for Entity<Worktree> {
|
|||
|
||||
let mut events = cx.events(&tree);
|
||||
while events.next().await.is_some() {
|
||||
if tree.update(cx, |tree, _| tree.entry_for_path(file_name).is_some()) {
|
||||
if tree.read_with(cx, |tree, _| tree.entry_for_path(file_name).is_some()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5103,7 +5103,7 @@ impl WorktreeModelHandle for Entity<Worktree> {
|
|||
.await
|
||||
.unwrap();
|
||||
while events.next().await.is_some() {
|
||||
if tree.update(cx, |tree, _| tree.entry_for_path(file_name).is_none()) {
|
||||
if tree.read_with(cx, |tree, _| tree.entry_for_path(file_name).is_none()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -5128,7 +5128,7 @@ impl WorktreeModelHandle for Entity<Worktree> {
|
|||
let file_name = "fs-event-sentinel";
|
||||
|
||||
let tree = self.clone();
|
||||
let (fs, root_path, mut git_dir_scan_id) = self.update(cx, |tree, _| {
|
||||
let (fs, root_path, mut git_dir_scan_id) = self.read_with(cx, |tree, _| {
|
||||
let tree = tree.as_local().unwrap();
|
||||
let local_repo_entry = tree
|
||||
.git_repositories
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue