From 847596af6e6e3f263ab98d26cdeaab250679b319 Mon Sep 17 00:00:00 2001 From: Marshall Bowers Date: Mon, 6 Jan 2025 18:02:51 -0500 Subject: [PATCH] assistant2: Expand some variable names (#22742) This PR expands some variables names in the `ThreadStore` for better readability. Release Notes: - N/A --- crates/assistant2/src/context_store.rs | 30 +++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/assistant2/src/context_store.rs b/crates/assistant2/src/context_store.rs index c7443937924fd53d7a1dcd243b1cb103702efd0f..9b4753544197b76e84797b76b7ea7186adf0a131 100644 --- a/crates/assistant2/src/context_store.rs +++ b/crates/assistant2/src/context_store.rs @@ -112,22 +112,22 @@ impl ContextStore { } pub fn remove_context(&mut self, id: &ContextId) { - let Some(ix) = self.context.iter().position(|c| c.id == *id) else { + let Some(ix) = self.context.iter().position(|context| context.id == *id) else { return; }; match self.context.remove(ix).kind { ContextKind::File => { - self.files.retain(|_, p_id| p_id != id); + self.files.retain(|_, context_id| context_id != id); } ContextKind::Directory => { - self.directories.retain(|_, p_id| p_id != id); + self.directories.retain(|_, context_id| context_id != id); } ContextKind::FetchedUrl => { - self.fetched_urls.retain(|_, p_id| p_id != id); + self.fetched_urls.retain(|_, context_id| context_id != id); } ContextKind::Thread => { - self.threads.retain(|_, p_id| p_id != id); + self.threads.retain(|_, context_id| context_id != id); } } } @@ -170,23 +170,23 @@ pub enum IncludedFile { InDirectory(PathBuf), } -pub(crate) fn push_fenced_codeblock(path: &Path, content: String, buf: &mut String) { - buf.reserve(content.len() + 64); +pub(crate) fn push_fenced_codeblock(path: &Path, content: String, buffer: &mut String) { + buffer.reserve(content.len() + 64); - write!(buf, "```").unwrap(); + write!(buffer, "```").unwrap(); if let Some(extension) = path.extension().and_then(|ext| ext.to_str()) { - write!(buf, "{} ", extension).unwrap(); + write!(buffer, "{} ", extension).unwrap(); } - write!(buf, "{}", path.display()).unwrap(); + write!(buffer, "{}", path.display()).unwrap(); - buf.push('\n'); - buf.push_str(&content); + buffer.push('\n'); + buffer.push_str(&content); - if !buf.ends_with('\n') { - buf.push('\n'); + if !buffer.ends_with('\n') { + buffer.push('\n'); } - buf.push_str("```\n"); + buffer.push_str("```\n"); }