assistant2: Inline read
calls (#22982)
This PR inlines the `read` calls on models in a few spots. Release Notes: - N/A
This commit is contained in:
parent
0f1c2a8d01
commit
dad1a3bd31
1 changed files with 3 additions and 5 deletions
|
@ -260,10 +260,9 @@ impl ContextStore {
|
||||||
|
|
||||||
pub fn insert_thread(&mut self, thread: Model<Thread>, cx: &AppContext) {
|
pub fn insert_thread(&mut self, thread: Model<Thread>, cx: &AppContext) {
|
||||||
let id = self.next_context_id.post_inc();
|
let id = self.next_context_id.post_inc();
|
||||||
let thread_ref = thread.read(cx);
|
let text = thread.read(cx).text().into();
|
||||||
let text = thread_ref.text().into();
|
|
||||||
|
|
||||||
self.threads.insert(thread_ref.id().clone(), id);
|
self.threads.insert(thread.read(cx).id().clone(), id);
|
||||||
self.context
|
self.context
|
||||||
.push(Context::Thread(ThreadContext { id, thread, text }));
|
.push(Context::Thread(ThreadContext { id, thread, text }));
|
||||||
}
|
}
|
||||||
|
@ -499,8 +498,7 @@ pub fn refresh_context_store_text(
|
||||||
cx: &AppContext,
|
cx: &AppContext,
|
||||||
) -> impl Future<Output = ()> {
|
) -> impl Future<Output = ()> {
|
||||||
let mut tasks = Vec::new();
|
let mut tasks = Vec::new();
|
||||||
let context_store_ref = context_store.read(cx);
|
for context in &context_store.read(cx).context {
|
||||||
for context in &context_store_ref.context {
|
|
||||||
match context {
|
match context {
|
||||||
Context::File(file_context) => {
|
Context::File(file_context) => {
|
||||||
let context_store = context_store.clone();
|
let context_store = context_store.clone();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue