Use read()
over read_with()
to improve readability in simple cases (#31455)
Follow up to: #31263 Release Notes: - N/A
This commit is contained in:
parent
5bafb2b160
commit
534bb0620d
9 changed files with 80 additions and 94 deletions
|
@ -222,9 +222,8 @@ impl LocalMode {
|
|||
) -> Task<()> {
|
||||
let breakpoints =
|
||||
breakpoint_store
|
||||
.read_with(cx, |store, cx| {
|
||||
store.source_breakpoints_from_path(&abs_path, cx)
|
||||
})
|
||||
.read(cx)
|
||||
.source_breakpoints_from_path(&abs_path, cx)
|
||||
.into_iter()
|
||||
.filter(|bp| bp.state.is_enabled())
|
||||
.chain(self.tmp_breakpoint.iter().filter_map(|breakpoint| {
|
||||
|
@ -303,8 +302,7 @@ impl LocalMode {
|
|||
cx: &App,
|
||||
) -> Task<HashMap<Arc<Path>, anyhow::Error>> {
|
||||
let mut breakpoint_tasks = Vec::new();
|
||||
let breakpoints =
|
||||
breakpoint_store.read_with(cx, |store, cx| store.all_source_breakpoints(cx));
|
||||
let breakpoints = breakpoint_store.read(cx).all_source_breakpoints(cx);
|
||||
let mut raw_breakpoints = breakpoint_store.read_with(cx, |this, _| this.all_breakpoints());
|
||||
debug_assert_eq!(raw_breakpoints.len(), breakpoints.len());
|
||||
let session_id = self.client.id();
|
||||
|
|
|
@ -3870,9 +3870,7 @@ impl Project {
|
|||
}
|
||||
|
||||
pub fn find_worktree(&self, abs_path: &Path, cx: &App) -> Option<(Entity<Worktree>, PathBuf)> {
|
||||
self.worktree_store.read_with(cx, |worktree_store, cx| {
|
||||
worktree_store.find_worktree(abs_path, cx)
|
||||
})
|
||||
self.worktree_store.read(cx).find_worktree(abs_path, cx)
|
||||
}
|
||||
|
||||
pub fn is_shared(&self) -> bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue