From 7f7312ca8f8fc7e1888a50a67b4b1fd466f8f9f7 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 22 Oct 2025 11:09:02 -0400 Subject: [PATCH] Use a static slice rather than vec --- crates/agent_servers/src/agent_servers.rs | 8 ++++---- crates/agent_servers/src/claude.rs | 8 ++++---- crates/agent_servers/src/gemini.rs | 4 ++-- crates/agent_ui/src/acp/thread_view.rs | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/agent_servers/src/agent_servers.rs b/crates/agent_servers/src/agent_servers.rs index 006739ed0595fa5c6868cbe3db1af8ed95e7c8c8..a723fd51deac6be2aba0a38721074c551328f52f 100644 --- a/crates/agent_servers/src/agent_servers.rs +++ b/crates/agent_servers/src/agent_servers.rs @@ -71,15 +71,15 @@ pub trait AgentServer: Send { /// Returns the list of slash commands that should trigger Zed's authentication UI /// when the user types them (e.g., "/login"). /// These commands will be intercepted by Zed to show the auth method selection UI. - fn login_commands(&self) -> Vec<&'static str> { - Vec::new() + fn login_commands(&self) -> &'static [&'static str] { + &[] } /// Returns the list of logout-related slash commands that should be sent to the agent /// to let it reset internal state (e.g., "/logout"). /// These commands will be added to available_commands and passed through to the agent. - fn logout_commands(&self) -> Vec<&'static str> { - Vec::new() + fn logout_commands(&self) -> &'static [&'static str] { + &[] } fn connect( diff --git a/crates/agent_servers/src/claude.rs b/crates/agent_servers/src/claude.rs index 914b43805dea5f5e0c3588b924a81c616904395c..db6cae720ee41d37886342509abfa51140b6fd50 100644 --- a/crates/agent_servers/src/claude.rs +++ b/crates/agent_servers/src/claude.rs @@ -56,12 +56,12 @@ impl AgentServer for ClaudeCode { }); } - fn login_commands(&self) -> Vec<&'static str> { - vec!["login"] + fn login_commands(&self) -> &'static [&'static str] { + &["login"] } - fn logout_commands(&self) -> Vec<&'static str> { - vec!["logout"] + fn logout_commands(&self) -> &'static [&'static str] { + &["logout"] } fn connect( diff --git a/crates/agent_servers/src/gemini.rs b/crates/agent_servers/src/gemini.rs index 1fba2cb39df5793500c03944cb2221aabfb105c9..605a3164c3c0d214b58d98fddd3bd4cb6d340ae7 100644 --- a/crates/agent_servers/src/gemini.rs +++ b/crates/agent_servers/src/gemini.rs @@ -25,8 +25,8 @@ impl AgentServer for Gemini { ui::IconName::AiGemini } - fn login_commands(&self) -> Vec<&'static str> { - vec!["login"] + fn login_commands(&self) -> &'static [&'static str] { + &["login"] } fn connect( diff --git a/crates/agent_ui/src/acp/thread_view.rs b/crates/agent_ui/src/acp/thread_view.rs index c25464e9f3c16f95f7a887c6a64a66d74b0d4618..8bed99c92b32814c83c54b19b2c6c0b54b96cf50 100644 --- a/crates/agent_ui/src/acp/thread_view.rs +++ b/crates/agent_ui/src/acp/thread_view.rs @@ -1441,7 +1441,7 @@ impl AcpThreadView { // Add login commands from the agent for command_name in self.agent.login_commands() { available_commands.push(acp::AvailableCommand { - name: command_name.to_owned(), + name: command_name.to_string(), description: "Authenticate".to_owned(), input: None, meta: None, @@ -1451,7 +1451,7 @@ impl AcpThreadView { // Add logout commands from the agent for command_name in self.agent.logout_commands() { available_commands.push(acp::AvailableCommand { - name: command_name.to_owned(), + name: command_name.to_string(), description: "Authenticate".to_owned(), input: None, meta: None,