From dad1a3bd3112a0c7dd98f87c1e7885eca899377d Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Fri, 10 Jan 2025 16:54:50 -0500 Subject: [PATCH] assistant2: Inline `read` calls (#22982) This PR inlines the `read` calls on models in a few spots. Release Notes: - N/A --- crates/assistant2/src/context_store.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/crates/assistant2/src/context_store.rs b/crates/assistant2/src/context_store.rs index 7c541da1c6..74e84b1cd1 100644 --- a/crates/assistant2/src/context_store.rs +++ b/crates/assistant2/src/context_store.rs @@ -260,10 +260,9 @@ impl ContextStore { pub fn insert_thread(&mut self, thread: Model, cx: &AppContext) { let id = self.next_context_id.post_inc(); - let thread_ref = thread.read(cx); - let text = thread_ref.text().into(); + let text = thread.read(cx).text().into(); - self.threads.insert(thread_ref.id().clone(), id); + self.threads.insert(thread.read(cx).id().clone(), id); self.context .push(Context::Thread(ThreadContext { id, thread, text })); } @@ -499,8 +498,7 @@ pub fn refresh_context_store_text( cx: &AppContext, ) -> impl Future { let mut tasks = Vec::new(); - let context_store_ref = context_store.read(cx); - for context in &context_store_ref.context { + for context in &context_store.read(cx).context { match context { Context::File(file_context) => { let context_store = context_store.clone();