Clean up warnings in agent2

Nathan Sobo created

- Remove underscore prefix from BasePrompt struct name
- Remove unused imports and variables in tests
- Fix unused parameter warning in async closure
- Rename AgentToolErased to AnyAgentTool for clarity

Change summary

crates/agent2/src/prompts.rs   | 4 ++--
crates/agent2/src/tests/mod.rs | 6 +-----
crates/agent2/src/thread.rs    | 8 ++++----
3 files changed, 7 insertions(+), 11 deletions(-)

Detailed changes

crates/agent2/src/prompts.rs 🔗

@@ -7,11 +7,11 @@ use gpui::{App, Entity};
 use project::Project;
 
 #[allow(dead_code)]
-struct _BasePrompt {
+struct BasePrompt {
     project: Entity<Project>,
 }
 
-impl Prompt for _BasePrompt {
+impl Prompt for BasePrompt {
     fn render(&self, templates: &Templates, cx: &App) -> Result<String> {
         BaseTemplate {
             os: std::env::consts::OS.to_string(),

crates/agent2/src/tests/mod.rs 🔗

@@ -1,7 +1,6 @@
 use super::*;
 use crate::templates::Templates;
 use client::{Client, UserStore};
-use fs::FakeFs;
 use gpui::{AppContext, Entity, TestAppContext};
 use language_model::{
     LanguageModel, LanguageModelCompletionError, LanguageModelCompletionEvent,
@@ -209,9 +208,6 @@ struct AgentTest {
 async fn setup(cx: &mut TestAppContext) -> AgentTest {
     cx.executor().allow_parking();
     cx.update(settings::init);
-    let fs = FakeFs::new(cx.executor().clone());
-    // let project = Project::test(fs.clone(), [], cx).await;
-    // let action_log = cx.new(|_| ActionLog::new(project.clone()));
     let templates = Templates::new();
     let agent = cx.new(|_| Thread::new(templates));
 
@@ -236,7 +232,7 @@ async fn setup(cx: &mut TestAppContext) -> AgentTest {
             let provider = models.provider(&model.provider_id()).unwrap();
             let authenticated = provider.authenticate(cx);
 
-            cx.spawn(async move |cx| {
+            cx.spawn(async move |_cx| {
                 authenticated.await.unwrap();
                 model
             })

crates/agent2/src/thread.rs 🔗

@@ -35,7 +35,7 @@ pub struct Thread {
     /// we run tools, report their results.
     running_turn: Option<Task<()>>,
     system_prompts: Vec<Arc<dyn Prompt>>,
-    tools: BTreeMap<SharedString, Arc<dyn AgentToolErased>>,
+    tools: BTreeMap<SharedString, Arc<dyn AnyAgentTool>>,
     templates: Arc<Templates>,
     // project: Entity<Project>,
     // action_log: Entity<ActionLog>,
@@ -390,21 +390,21 @@ where
     /// Runs the tool with the provided input.
     fn run(self: Arc<Self>, input: Self::Input, cx: &mut App) -> Task<Result<String>>;
 
-    fn erase(self) -> Arc<dyn AgentToolErased> {
+    fn erase(self) -> Arc<dyn AnyAgentTool> {
         Arc::new(Erased(Arc::new(self)))
     }
 }
 
 pub struct Erased<T>(T);
 
-pub trait AgentToolErased {
+pub trait AnyAgentTool {
     fn name(&self) -> SharedString;
     fn description(&self, cx: &mut App) -> SharedString;
     fn input_schema(&self, format: LanguageModelToolSchemaFormat) -> Result<serde_json::Value>;
     fn run(self: Arc<Self>, input: serde_json::Value, cx: &mut App) -> Task<Result<String>>;
 }
 
-impl<T> AgentToolErased for Erased<Arc<T>>
+impl<T> AnyAgentTool for Erased<Arc<T>>
 where
     T: AgentTool,
 {