diff --git a/Cargo.lock b/Cargo.lock index a55eea8f434..345c9748448 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -9582,7 +9582,6 @@ dependencies = [ "language_model_core", "log", "parking_lot", - "serde_json", "thiserror 2.0.21", ] diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs index 190fa7776da..cff68705f33 100644 --- a/crates/acp_thread/src/acp_thread.rs +++ b/crates/acp_thread/src/acp_thread.rs @@ -4003,22 +4003,6 @@ pub enum TerminalProviderEvent { }, } -#[derive(Debug, Clone)] -pub enum TerminalProviderCommand { - WriteInput { - terminal_id: acp_v2::TerminalId, - bytes: Vec, - }, - Resize { - terminal_id: acp_v2::TerminalId, - cols: u16, - rows: u16, - }, - Close { - terminal_id: acp_v2::TerminalId, - }, -} - #[derive(PartialEq, Eq, Debug)] pub enum ThreadStatus { Unconfirmed, @@ -8226,11 +8210,9 @@ impl AcpThread { let buffer = load.await?; let snapshot = if reuse_shared_snapshot { - this.read_with(cx, |this, _| { - this.shared_buffers.get(&buffer.clone()).cloned() - }) - .log_err() - .flatten() + this.read_with(cx, |this, _| this.shared_buffers.get(&buffer).cloned()) + .log_err() + .flatten() } else { None }; diff --git a/crates/acp_thread/src/connection.rs b/crates/acp_thread/src/connection.rs index ce03f4df92c..0ffe8a0c724 100644 --- a/crates/acp_thread/src/connection.rs +++ b/crates/acp_thread/src/connection.rs @@ -764,10 +764,6 @@ impl AgentModelList { AgentModelList::Grouped(groups) => groups.is_empty(), } } - - pub fn is_flat(&self) -> bool { - matches!(self, AgentModelList::Flat(_)) - } } #[derive(Debug, Clone)] @@ -1035,7 +1031,6 @@ mod test_support { supports_close_session: bool, announces_subagents: bool, close_sessions_on_release: bool, - supports_session_additional_directories: bool, supports_set_title: bool, supports_truncate: bool, agent_id: AgentId, @@ -1086,7 +1081,6 @@ mod test_support { supports_close_session: false, announces_subagents: false, close_sessions_on_release: true, - supports_session_additional_directories: false, supports_set_title: true, supports_truncate: true, agent_id: AgentId::new("stub"), @@ -1252,14 +1246,6 @@ mod test_support { self } - pub fn with_supports_session_additional_directories( - mut self, - supports_session_additional_directories: bool, - ) -> Self { - self.supports_session_additional_directories = supports_session_additional_directories; - self - } - pub fn with_supports_set_title(mut self, supports_set_title: bool) -> Self { self.supports_set_title = supports_set_title; self @@ -1413,10 +1399,6 @@ mod test_support { } } - fn supports_session_additional_directories(&self) -> bool { - self.supports_session_additional_directories - } - fn load_session( self: Rc, session_id: acp_v2::SessionId, diff --git a/crates/acp_thread/src/terminal.rs b/crates/acp_thread/src/terminal.rs index 2e9b878a097..a13fdf6397e 100644 --- a/crates/acp_thread/src/terminal.rs +++ b/crates/acp_thread/src/terminal.rs @@ -57,10 +57,6 @@ pub struct SandboxWrap { /// Allow unrestricted filesystem writes except for protected paths (ignores /// ordinary writable paths). pub allow_fs_write: bool, - /// Whether the project (and therefore this terminal) is local. The - /// enforcing proxy binds a loopback port on this host, so it can only - /// confine local commands; a remote terminal can't reach it. - pub is_local: bool, /// Windows/WSL only: `(release channel, version)` of the Linux `zed` to /// provision inside WSL as the sandbox helper (version `latest` for dev /// builds). Resolved by the agent (which can read the running app's release diff --git a/crates/action_log/src/action_log.rs b/crates/action_log/src/action_log.rs index 838e274d52a..0100e7fe28c 100644 --- a/crates/action_log/src/action_log.rs +++ b/crates/action_log/src/action_log.rs @@ -1,6 +1,5 @@ use anyhow::{Context as _, Result}; use buffer_diff::BufferDiff; -use clock; use collections::{BTreeMap, HashMap}; use fs::MTime; use futures::{FutureExt, StreamExt, channel::mpsc}; @@ -1000,9 +999,7 @@ impl ActionLog { } } - if !valid_edits.is_empty() { - buffer.edit(valid_edits, None, cx); - } + buffer.edit(valid_edits, None, cx); }); if !self.tracked_buffers.contains_key(&buffer) { @@ -1286,11 +1283,6 @@ impl TrackedBuffer { &self.diff } - #[cfg(any(test, feature = "test-support"))] - pub fn diff_base_len(&self) -> usize { - self.diff_base.len() - } - fn has_edits(&self, cx: &App) -> bool { self.diff .read(cx) diff --git a/crates/agent/src/db.rs b/crates/agent/src/db.rs index 22277aa5570..adf88d1e711 100644 --- a/crates/agent/src/db.rs +++ b/crates/agent/src/db.rs @@ -26,7 +26,6 @@ use util::{ResultExt, path_list::PathList}; use zed_env_vars::ZED_STATELESS; pub type DbMessage = crate::Message; -pub type DbSummary = crate::legacy_thread::DetailedSummaryState; pub type DbLanguageModel = crate::legacy_thread::SerializedLanguageModel; #[derive(Debug, Clone)] diff --git a/crates/agent/src/tests/mod.rs b/crates/agent/src/tests/mod.rs index 8c7fd9d51c9..49ed70d36b7 100644 --- a/crates/agent/src/tests/mod.rs +++ b/crates/agent/src/tests/mod.rs @@ -7877,7 +7877,6 @@ async fn test_edit_file_tool_deny_rule_blocks_edit(cx: &mut TestAppContext) { }); let action_log = cx.update(|cx| thread.read(cx).action_log.clone()); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::EditFileTool::new( project.clone(), thread.downgrade(), @@ -7931,7 +7930,6 @@ async fn test_delete_path_tool_deny_rule_blocks_deletion(cx: &mut TestAppContext let action_log = cx.new(|_cx| action_log::ActionLog::new(project.clone())); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::DeletePathTool::new(project, action_log)); let (event_stream, _rx) = crate::ToolCallEventStream::test(); @@ -7983,7 +7981,6 @@ async fn test_move_path_tool_denies_if_destination_denied(cx: &mut TestAppContex agent_settings::AgentSettings::override_global(settings, cx); }); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::MovePathTool::new(project)); let (event_stream, _rx) = crate::ToolCallEventStream::test(); @@ -8039,7 +8036,6 @@ async fn test_move_path_tool_denies_if_source_denied(cx: &mut TestAppContext) { agent_settings::AgentSettings::override_global(settings, cx); }); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::MovePathTool::new(project)); let (event_stream, _rx) = crate::ToolCallEventStream::test(); @@ -8097,7 +8093,6 @@ async fn test_copy_path_tool_deny_rule_blocks_copy(cx: &mut TestAppContext) { agent_settings::AgentSettings::override_global(settings, cx); }); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::CopyPathTool::new(project)); let (event_stream, _rx) = crate::ToolCallEventStream::test(); @@ -8141,7 +8136,6 @@ async fn test_web_search_tool_deny_rule_blocks_search(cx: &mut TestAppContext) { agent_settings::AgentSettings::override_global(settings, cx); }); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::WebSearchTool); let (event_stream, _rx) = crate::ToolCallEventStream::test(); @@ -8203,7 +8197,6 @@ async fn test_edit_file_tool_allow_rule_skips_confirmation(cx: &mut TestAppConte }); let action_log = thread.read_with(cx, |thread, _cx| thread.action_log().clone()); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::EditFileTool::new( project, thread.downgrade(), @@ -8271,7 +8264,6 @@ async fn test_edit_file_tool_allow_still_prompts_for_local_settings(cx: &mut Tes }); let action_log = thread.read_with(cx, |thread, _cx| thread.action_log().clone()); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::EditFileTool::new( project, thread.downgrade(), @@ -8320,7 +8312,6 @@ async fn test_fetch_tool_deny_rule_blocks_url(cx: &mut TestAppContext) { let http_client = gpui::http_client::FakeHttpClient::with_200_response(); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, _rx) = crate::ToolCallEventStream::test(); @@ -8364,7 +8355,6 @@ async fn test_fetch_tool_allow_rule_skips_confirmation(cx: &mut TestAppContext) let http_client = gpui::http_client::FakeHttpClient::with_200_response(); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, mut rx) = crate::ToolCallEventStream::test(); @@ -8405,7 +8395,6 @@ async fn test_fetch_tool_prompts_for_ungranted_host(cx: &mut TestAppContext) { let http_client = gpui::http_client::FakeHttpClient::with_200_response(); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, mut rx) = crate::ToolCallEventStream::test(); @@ -8453,7 +8442,6 @@ async fn test_fetch_tool_granted_host_skips_prompt(cx: &mut TestAppContext) { let http_client = gpui::http_client::FakeHttpClient::with_200_response(); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, mut rx) = crate::ToolCallEventStream::test(); @@ -8495,7 +8483,6 @@ async fn test_fetch_tool_refuses_loopback_without_unsandboxed(cx: &mut TestAppCo let http_client = gpui::http_client::FakeHttpClient::with_200_response(); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, _rx) = crate::ToolCallEventStream::test(); @@ -8537,7 +8524,6 @@ async fn test_fetch_tool_unsandboxed_lifts_restrictions(cx: &mut TestAppContext) let http_client = gpui::http_client::FakeHttpClient::with_200_response(); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, mut rx) = crate::ToolCallEventStream::test(); @@ -8598,7 +8584,6 @@ async fn test_fetch_tool_refuses_redirect_to_loopback(cx: &mut TestAppContext) { .unwrap()) }); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, _rx) = crate::ToolCallEventStream::test(); @@ -8657,7 +8642,6 @@ async fn test_fetch_tool_reauthorizes_redirect_to_new_host(cx: &mut TestAppConte .unwrap()) }); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, mut rx) = crate::ToolCallEventStream::test(); @@ -8725,7 +8709,6 @@ async fn test_fetch_tool_follows_same_host_redirect(cx: &mut TestAppContext) { } }); - #[allow(clippy::arc_with_non_send_sync)] let tool = Arc::new(crate::FetchTool::new(http_client)); let (event_stream, mut rx) = crate::ToolCallEventStream::test(); diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index 484d672e060..340eab1a32b 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -1332,7 +1332,6 @@ pub struct Thread { /// the start of each request. current_request_token_usage: TokenUsage, pending_compaction_telemetry: Option, - #[allow(unused)] initial_project_snapshot: Shared>>>, pub(crate) context_server_registry: Entity, profile_id: AgentProfileId, @@ -4121,10 +4120,6 @@ impl Thread { self.title.clone() } - pub fn is_generating_summary(&self) -> bool { - self.pending_summary_generation.is_some() - } - pub fn is_generating_title(&self) -> bool { self.pending_title_generation.is_some() } @@ -4513,12 +4508,6 @@ impl Thread { self.running_turn.as_ref()?.tools.get(name).cloned() } - pub fn has_tool(&self, name: &str) -> bool { - self.running_turn - .as_ref() - .is_some_and(|turn| turn.tools.contains_key(name)) - } - #[cfg(any(test, feature = "test-support"))] pub fn has_registered_tool(&self, name: &str) -> bool { self.tools.contains_key(name) @@ -7158,18 +7147,6 @@ impl ToolCallEventStreamReceiver { panic!("Expected diff but got: {:?}", event); } } - - pub async fn expect_terminal(&mut self) -> Entity { - let event = self.0.next().await; - if let Some(Ok(ThreadEvent::ToolCallUpdate(acp_thread::ToolCallUpdate::UpdateTerminal( - update, - )))) = event - { - update.terminal - } else { - panic!("Expected terminal but got: {:?}", event); - } - } } #[cfg(any(test, feature = "test-support"))] diff --git a/crates/agent/src/tools/context_server_registry.rs b/crates/agent/src/tools/context_server_registry.rs index daaec1973bd..770bcf89395 100644 --- a/crates/agent/src/tools/context_server_registry.rs +++ b/crates/agent/src/tools/context_server_registry.rs @@ -61,17 +61,6 @@ impl ContextServerRegistry { this } - pub fn tools_for_server( - &self, - server_id: &ContextServerId, - ) -> impl Iterator> { - self.registered_servers - .get(server_id) - .map(|server| server.tools.values()) - .into_iter() - .flatten() - } - pub fn servers( &self, ) -> impl Iterator< diff --git a/crates/agent/src/tools/symbol_locator.rs b/crates/agent/src/tools/symbol_locator.rs index 1904e412c6f..62df8ba19b0 100644 --- a/crates/agent/src/tools/symbol_locator.rs +++ b/crates/agent/src/tools/symbol_locator.rs @@ -34,8 +34,6 @@ pub type CodeActionStore = Entity>; pub struct ResolvedSymbol { pub buffer: Entity, pub position: Anchor, - pub line_text: String, - pub truncated: bool, } pub const MAX_LINE_DISPLAY_LEN: usize = 200; @@ -165,7 +163,7 @@ impl SymbolLocator { .await .map_err(|e| format!("Failed to open '{}': {e}", self.file_path))?; - let (position, line_text, truncated) = buffer.read_with(cx, |buffer, _cx| { + let position = buffer.read_with(cx, |buffer, _cx| { let snapshot = buffer.snapshot(); let row = line.saturating_sub(1); @@ -177,7 +175,6 @@ impl SymbolLocator { } let line_len = snapshot.line_len(row); - let truncated = line_len as usize > MAX_LINE_DISPLAY_LEN; let line_start = Point::new(row, 0); let line_end = Point::new(row, line_len); let line_chars = || { @@ -198,22 +195,10 @@ impl SymbolLocator { ) })?; - let position = snapshot.anchor_before(Point::new(row, byte_offset as u32)); - let display_text: String = line_chars() - .skip_while(|c| c.is_whitespace()) - .take(MAX_LINE_DISPLAY_LEN) - .collect::(); - let display_text = display_text.trim_end().to_string(); - - Ok((position, display_text, truncated)) + Ok(snapshot.anchor_before(Point::new(row, byte_offset as u32))) })?; - Ok(ResolvedSymbol { - buffer, - position, - line_text, - truncated, - }) + Ok(ResolvedSymbol { buffer, position }) } } diff --git a/crates/agent/src/tools/terminal_tool.rs b/crates/agent/src/tools/terminal_tool.rs index 8198c9e85bf..00985322c4a 100644 --- a/crates/agent/src/tools/terminal_tool.rs +++ b/crates/agent/src/tools/terminal_tool.rs @@ -747,7 +747,6 @@ async fn run_terminal_tool( protected_paths, network: network_request_to_sandbox_network_access(&effective.network), allow_fs_write: effective.allow_fs_write_all, - is_local: is_local_project, wsl_zed_release: wsl_zed_release.clone(), }; @@ -1035,11 +1034,9 @@ async fn run_terminal_tool( let output = terminal.current_output(cx).map_err(|e| e.to_string())?; let result = process_content(output, &input.command, timed_out, user_stopped, selection); - let notes = sandbox_note.into_iter().collect::>(); - Ok(if notes.is_empty() { - result - } else { - format!("{}\n\n{result}", notes.join("\n\n")) + Ok(match sandbox_note { + Some(note) => format!("{note}\n\n{result}"), + None => result, }) } @@ -1122,9 +1119,7 @@ fn wsl_drive_mount_path_to_windows_path(raw: &str) -> Option { } let mut windows_path = format!("{drive}:\\"); - if !rest.is_empty() { - windows_path.push_str(&rest.replace('/', "\\")); - } + windows_path.push_str(&rest.replace('/', "\\")); Some(PathBuf::from(windows_path)) } diff --git a/crates/agent/src/tools/tool_permissions.rs b/crates/agent/src/tools/tool_permissions.rs index 571d494c4b3..0c0098c30bf 100644 --- a/crates/agent/src/tools/tool_permissions.rs +++ b/crates/agent/src/tools/tool_permissions.rs @@ -350,20 +350,6 @@ pub fn authorize_symlink_escapes( event_stream.authorize_always_prompt(title, context, cx) } -/// Checks whether a path escapes the project via symlink, without creating -/// an authorization task. Useful for pre-filtering paths before settings checks. -pub fn path_has_symlink_escape( - project: &Project, - path: impl AsRef, - canonical_worktree_roots: &[PathBuf], - cx: &App, -) -> bool { - matches!( - resolve_project_path(project, path, canonical_worktree_roots, cx), - Ok(ResolvedProjectPath::SymlinkEscape { .. }) - ) -} - /// Collects symlink escape info for a path without creating an authorization task. /// Returns `Some((display_path, canonical_target))` if the path escapes via symlink. pub fn detect_symlink_escape<'a>( diff --git a/crates/agent_servers/src/acp/v1.rs b/crates/agent_servers/src/acp/v1.rs index 8dca99481c2..a86f1254017 100644 --- a/crates/agent_servers/src/acp/v1.rs +++ b/crates/agent_servers/src/acp/v1.rs @@ -22,7 +22,6 @@ use agent_client_protocol::{ v2::schema as acp_v2, }; use anyhow::anyhow; -use async_channel; use collections::HashMap; use feature_flags::{AcpBetaFeatureFlag, FeatureFlagAppExt as _}; use futures::channel::mpsc; diff --git a/crates/agent_servers/src/e2e_tests.rs b/crates/agent_servers/src/e2e_tests.rs index 6e5d1975f8a..28ebba58040 100644 --- a/crates/agent_servers/src/e2e_tests.rs +++ b/crates/agent_servers/src/e2e_tests.rs @@ -13,11 +13,7 @@ use indoc::indoc; use project::{FakeFs, Project}; #[cfg(test)] use settings::Settings; -use std::{ - path::{Path, PathBuf}, - sync::Arc, - time::Duration, -}; +use std::{path::Path, sync::Arc, time::Duration}; use util::path; use util::path_list::PathList; @@ -509,27 +505,6 @@ pub async fn run_until_first_tool_call( } } -pub fn get_zed_path() -> PathBuf { - let mut zed_path = std::env::current_exe().unwrap(); - - while zed_path - .file_name() - .is_none_or(|name| name.to_string_lossy() != "debug") - { - if !zed_path.pop() { - panic!("Could not find target directory"); - } - } - - zed_path.push("zed"); - - if !zed_path.exists() { - panic!("\n🚨 Run `cargo build` at least once before running e2e tests\n\n"); - } - - zed_path -} - #[cfg(test)] mod tests { use super::*; diff --git a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs index 1ae1ab1f36a..4fcb56b3873 100644 --- a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs +++ b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs @@ -1148,17 +1148,17 @@ impl Render for ConfigureContextServerModal { self.render_loading("Connecting Server…") } State::AuthRequired { server_id } => { - self.render_auth_required(&server_id.clone(), cx) + self.render_auth_required(server_id, cx) } State::ClientSecretRequired { server_id, error } => { self.render_client_secret_required( - &server_id.clone(), + server_id, error.clone(), cx, ) } State::Authenticating { server_id } => { - self.render_authenticating(&server_id.clone(), cx) + self.render_authenticating(server_id, cx) } State::Error(error) => { Self::render_modal_error(error.clone()) diff --git a/crates/agent_ui/src/agent_diff.rs b/crates/agent_ui/src/agent_diff.rs index fc0aee8a81e..61151ee8c64 100644 --- a/crates/agent_ui/src/agent_diff.rs +++ b/crates/agent_ui/src/agent_diff.rs @@ -726,7 +726,7 @@ impl Render for AgentDiffPane { .full_width() .key_binding(KeyBinding::for_action_in( &ToggleFocus, - &focus_handle.clone(), + focus_handle, cx, )) .on_click(|_event, window, cx| { diff --git a/crates/agent_ui/src/agent_panel.rs b/crates/agent_ui/src/agent_panel.rs index 087aeeecbe5..603589f444f 100644 --- a/crates/agent_ui/src/agent_panel.rs +++ b/crates/agent_ui/src/agent_panel.rs @@ -3316,33 +3316,6 @@ impl AgentPanel { thread_id } - pub fn activate_retained_thread( - &mut self, - id: ThreadId, - focus: bool, - window: &mut Window, - cx: &mut Context, - ) { - let conversation_view = if let Some(view) = self.remove_retained_thread(&id) { - self.try_make_empty_draft_ephemeral(view.clone(), cx); - view - } else if let Some(draft) = &self.draft_thread { - if draft.read(cx).thread_id == id { - draft.clone() - } else { - return; - } - } else { - return; - }; - self.set_base_view( - BaseView::AgentThread { conversation_view }, - focus, - window, - cx, - ); - } - pub fn active_thread_id(&self, cx: &App) -> Option { match &self.base_view { BaseView::AgentThread { conversation_view } => { @@ -3950,7 +3923,7 @@ impl AgentPanel { cx.spawn_in(window, async move |this, cx| { thread_store - .update(&mut cx.clone(), |store, cx| { + .update(cx, |store, cx| { store.save_thread(session_id.clone(), db_thread, Default::default(), cx) }) .await?; diff --git a/crates/agent_ui/src/agent_ui.rs b/crates/agent_ui/src/agent_ui.rs index 9e55982828e..9123ea34b09 100644 --- a/crates/agent_ui/src/agent_ui.rs +++ b/crates/agent_ui/src/agent_ui.rs @@ -89,7 +89,6 @@ pub use thread_import::{ AcpThreadImportOnboarding, CrossChannelImportOnboarding, ThreadImportModal, channels_with_threads, import_threads_from_other_channels, }; -use zed_actions; pub use zed_actions::agent::CycleFavoriteModels; pub use zed_actions::{CreateWorktree, NewWorktreeBranchTarget, SwitchWorktree}; diff --git a/crates/agent_ui/src/conversation_view.rs b/crates/agent_ui/src/conversation_view.rs index 2c5caa42911..22d3249aa5f 100644 --- a/crates/agent_ui/src/conversation_view.rs +++ b/crates/agent_ui/src/conversation_view.rs @@ -1311,7 +1311,6 @@ impl ConversationView { }); }); } - cx.notify(); } fn initial_state( @@ -1714,7 +1713,7 @@ impl ConversationView { let agent_display_name = self .agent_server_store .read(cx) - .agent_display_name(&agent_id.clone()) + .agent_display_name(&agent_id) .unwrap_or_else(|| agent_id.0.clone()); let agent_icon = self.agent.logo(); diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rs index d235b114b21..e8cb8da9cff 100644 --- a/crates/agent_ui/src/conversation_view/thread_view.rs +++ b/crates/agent_ui/src/conversation_view/thread_view.rs @@ -2917,7 +2917,6 @@ impl ThreadView { message_editor.update(cx, |message_editor, cx| { message_editor.clear(window, cx); }); - cx.notify(); })?; Ok(()) }) @@ -3298,7 +3297,6 @@ impl ThreadView { } self.set_editor_is_expanded(!self.editor_expanded, cx); cx.stop_propagation(); - cx.notify(); } pub fn set_editor_is_expanded(&mut self, is_expanded: bool, cx: &mut Context) { @@ -5422,7 +5420,7 @@ impl ThreadView { this.tooltip(Tooltip::text(EDIT_NOT_READY_TOOLTIP_LABEL)) }) .key_binding( - KeyBinding::for_action_in(&RejectAll, &focus_handle.clone(), cx) + KeyBinding::for_action_in(&RejectAll, &focus_handle, cx) .map(|kb| kb.size(rems_from_px(12_f32))), ) .on_click(cx.listener(move |this, _, window, cx| { @@ -5979,7 +5977,7 @@ impl ThreadView { this.key_binding( KeyBinding::for_action_in( action.as_ref(), - &focus_handle.clone(), + &focus_handle, cx, ) .map(|kb| kb.size(keybinding_size)), @@ -8657,7 +8655,9 @@ impl ThreadView { window: &mut Window, cx: &mut Context, ) { - if self.thread_search_bar.is_none() { + let search_bar = if let Some(search_bar) = self.thread_search_bar.clone() { + search_bar + } else { let thread = self.thread.clone(); let view = cx.entity().downgrade(); let on_activate = @@ -8696,27 +8696,21 @@ impl ThreadView { } }, )); - self.thread_search_bar = Some(search_bar); - } + self.thread_search_bar = Some(search_bar.clone()); + search_bar + }; // Re-focus an open bar unless it already owns focus. - let search_bar_focused = self - .thread_search_bar - .as_ref() - .is_some_and(|bar| bar.focus_handle(cx).contains_focused(window, cx)); + let search_bar_focused = search_bar.focus_handle(cx).contains_focused(window, cx); if self.thread_search_visible && search_bar_focused { - if let Some(bar) = &self.thread_search_bar { - bar.update(cx, |bar, cx| bar.clear_highlights(cx)); - } + search_bar.update(cx, |bar, cx| bar.clear_highlights(cx)); self.thread_search_visible = false; self.message_editor.focus_handle(cx).focus(window, cx); cx.notify(); } else { self.thread_search_visible = true; - if let Some(bar) = self.thread_search_bar.clone() { - bar.update(cx, |bar, cx| bar.focus_and_refresh(window, cx)); - } + search_bar.update(cx, |bar, cx| bar.focus_and_refresh(window, cx)); cx.notify(); } } @@ -13437,7 +13431,6 @@ impl ThreadView { .on_click(cx.listener({ move |this, _, _, cx| { this.clear_thread_error(cx); - cx.notify(); } })) } diff --git a/crates/agent_ui/src/mention_set.rs b/crates/agent_ui/src/mention_set.rs index 9f0ce0b81a2..10a0db0afe1 100644 --- a/crates/agent_ui/src/mention_set.rs +++ b/crates/agent_ui/src/mention_set.rs @@ -808,13 +808,10 @@ mod tests { use fs::FakeFs; use gpui::TestAppContext; use project::Project; - use prompt_store; - use release_channel; use semver::Version; use serde_json::json; use settings::SettingsStore; use std::path::Path; - use theme; use util::path; fn init_test(cx: &mut TestAppContext) { diff --git a/crates/agent_ui/src/profile_selector.rs b/crates/agent_ui/src/profile_selector.rs index ea4d8b8cf1f..0f096f125d6 100644 --- a/crates/agent_ui/src/profile_selector.rs +++ b/crates/agent_ui/src/profile_selector.rs @@ -126,7 +126,9 @@ impl ProfileSelector { window: &mut Window, cx: &mut Context, ) -> Entity> { - if self.picker.is_none() { + let picker = if let Some(picker) = self.picker.clone() { + picker + } else { let delegate = ProfilePickerDelegate::new( self.fs.clone(), self.provider.clone(), @@ -143,24 +145,23 @@ impl ProfileSelector { .initial_width(rems(18.)) }); - self.picker = Some(picker); - } + self.picker = Some(picker.clone()); + picker + }; if self.pending_refresh { - if let Some(picker) = &self.picker { - let profiles = AgentProfile::available_profiles(cx); - self.profiles = profiles.clone(); - picker.update(cx, |picker, cx| { - let query = picker.query(cx); - picker - .delegate - .refresh_profiles(profiles.clone(), query, cx); - }); - } + let profiles = AgentProfile::available_profiles(cx); + self.profiles = profiles.clone(); + picker.update(cx, |picker, cx| { + let query = picker.query(cx); + picker + .delegate + .refresh_profiles(profiles.clone(), query, cx); + }); self.pending_refresh = false; } - self.picker.as_ref().unwrap().clone() + picker } } diff --git a/crates/agent_ui/src/test_support.rs b/crates/agent_ui/src/test_support.rs index 70af3e2e833..dec3a7f3747 100644 --- a/crates/agent_ui/src/test_support.rs +++ b/crates/agent_ui/src/test_support.rs @@ -33,15 +33,6 @@ pub fn set_stub_agent_connection(connection: StubAgentConnection) -> StubAgentCo connection } -/// Returns the shared `StubAgentConnection` used by `Agent::Stub`, -/// creating a default one if none was registered. -pub fn stub_agent_connection() -> StubAgentConnection { - STUB_AGENT_CONNECTION.with(|cell| { - let mut borrow = cell.borrow_mut(); - borrow.get_or_insert_with(StubAgentConnection::new).clone() - }) -} - pub struct StubAgentServer { connection: C, agent_id: AgentId, diff --git a/crates/agent_ui/src/thread_metadata_store.rs b/crates/agent_ui/src/thread_metadata_store.rs index b2decba516b..2f13d858840 100644 --- a/crates/agent_ui/src/thread_metadata_store.rs +++ b/crates/agent_ui/src/thread_metadata_store.rs @@ -933,23 +933,6 @@ impl ThreadMetadataStore { self.in_flight_archives.remove(&thread_id); } - /// Returns `true` if any unarchived thread other than `thread_id` - /// references `path` in its folder paths. Used to determine whether a - /// worktree can safely be removed from disk. - pub fn path_is_referenced_by_unarchived_threads( - &self, - thread_id: Option, - path: &Path, - remote_connection: Option<&RemoteConnectionOptions>, - ) -> bool { - self.path_is_referenced_by_unarchived_threads_matching( - thread_id, - path, - remote_connection, - |_| true, - ) - } - pub fn path_is_referenced_by_unarchived_threads_matching( &self, thread_id: Option, diff --git a/crates/anthropic/src/anthropic.rs b/crates/anthropic/src/anthropic.rs index 555266e70a0..015687589c8 100644 --- a/crates/anthropic/src/anthropic.rs +++ b/crates/anthropic/src/anthropic.rs @@ -1351,10 +1351,6 @@ impl ApiError { ApiErrorCode::from_str(&self.error_type).ok() } - pub fn is_rate_limit_error(&self) -> bool { - matches!(self.error_type.as_str(), "rate_limit_error") - } - pub fn match_window_exceeded(&self) -> Option { let Some(ApiErrorCode::InvalidRequestError) = self.code() else { return None; diff --git a/crates/context_server/src/client.rs b/crates/context_server/src/client.rs index 1425267d3fd..88b2f2857b2 100644 --- a/crates/context_server/src/client.rs +++ b/crates/context_server/src/client.rs @@ -54,7 +54,6 @@ pub(crate) struct Client { name: Arc, subscription_set: Arc>, response_handlers: Arc>>>, - #[allow(clippy::type_complexity)] #[allow(dead_code)] io_tasks: Mutex>, Task>)>>, output_done_rx: Mutex>, @@ -110,7 +109,6 @@ struct AnyResponse<'a> { } #[derive(Serialize, Deserialize)] -#[allow(dead_code)] pub(crate) struct Response { pub jsonrpc: &'static str, pub id: RequestId, @@ -123,7 +121,6 @@ pub(crate) struct Response { pub(crate) enum CspResult { #[serde(rename = "result")] Ok(Option), - #[allow(dead_code)] Error(Option), } diff --git a/crates/context_server/src/listener.rs b/crates/context_server/src/listener.rs index 0a3f4bcc319..2a7679a5aee 100644 --- a/crates/context_server/src/listener.rs +++ b/crates/context_server/src/listener.rs @@ -220,7 +220,7 @@ impl McpServer { Self::handle_call_tool(request_id, request.params, &tools, &outgoing_tx, cx) .await; } else if request.method == ListTools::METHOD { - Self::handle_list_tools(request.id.unwrap(), &tools, &outgoing_tx); + Self::handle_list_tools(request_id, &tools, &outgoing_tx); } else if let Some(handler) = handlers.borrow().get(&request.method.as_ref()) { let outgoing_tx = outgoing_tx.clone(); diff --git a/crates/context_server/src/types.rs b/crates/context_server/src/types.rs index 803f11b4ccd..89f466a6def 100644 --- a/crates/context_server/src/types.rs +++ b/crates/context_server/src/types.rs @@ -699,16 +699,6 @@ pub enum CompletionTotal { Unknown, } -impl CompletionTotal { - pub fn from_options(has_more: Option, total: Option) -> Self { - match (has_more, total) { - (_, Some(count)) => CompletionTotal::Exact(count), - (Some(true), _) => CompletionTotal::HasMore, - _ => CompletionTotal::Unknown, - } - } -} - pub struct Completion { pub values: Vec, pub total: CompletionTotal, diff --git a/crates/copilot/src/copilot.rs b/crates/copilot/src/copilot.rs index 8491c4781b1..7ff12f6ec1c 100644 --- a/crates/copilot/src/copilot.rs +++ b/crates/copilot/src/copilot.rs @@ -1151,36 +1151,23 @@ impl Copilot { futures::pin_mut!(nes_fut, inline_fut); - let mut nes_result: Option> = None; - let mut inline_result: Option> = None; - loop { select_biased! { nes = nes_fut => { if !nes.is_empty() { return Ok(nes); } - nes_result = Some(nes); } inline = inline_fut => { if !inline.is_empty() { return Ok(inline); } - inline_result = Some(inline); } complete => break, } - - if let (Some(nes), Some(inline)) = (&nes_result, &inline_result) { - return if !nes.is_empty() { - Ok(nes.clone()) - } else { - Ok(inline.clone()) - }; - } } - Ok(nes_result.or(inline_result).unwrap_or_default()) + Ok(Vec::new()) }) } diff --git a/crates/copilot/src/copilot_edit_prediction_delegate.rs b/crates/copilot/src/copilot_edit_prediction_delegate.rs index 02b319c1899..f28daa7e361 100644 --- a/crates/copilot/src/copilot_edit_prediction_delegate.rs +++ b/crates/copilot/src/copilot_edit_prediction_delegate.rs @@ -751,7 +751,7 @@ mod tests { }, }], ); - _ = editor.update_in(cx, |editor, window, cx| { + editor.update_in(cx, |editor, window, cx| { // Ensure copilot suggestions are shown for the first excerpt. editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| { s.select_ranges([Point::new(1, 5)..Point::new(1, 5)]) @@ -759,7 +759,7 @@ mod tests { editor.show_edit_prediction(&Default::default(), window, cx); }); executor.advance_clock(COPILOT_TEST_DEBOUNCE); - _ = editor.update_in(cx, |editor, _, _| { + editor.update_in(cx, |editor, _, _| { assert!(editor.has_active_edit_prediction()); }); pretty_assertions::assert_eq!( @@ -788,7 +788,7 @@ mod tests { }, }], ); - _ = editor.update_in(cx, |editor, window, cx| { + editor.update_in(cx, |editor, window, cx| { // Move to another excerpt, ensuring the suggestion gets cleared. editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| { s.select_ranges([Point::new(4, 5)..Point::new(4, 5)]) @@ -828,7 +828,7 @@ mod tests { // Ensure the new suggestion is displayed when the debounce timeout expires. executor.advance_clock(COPILOT_TEST_DEBOUNCE); - _ = editor.update(cx, |editor, _| { + editor.update(cx, |editor, _| { assert!(editor.has_active_edit_prediction()); }); assert_eq!( diff --git a/crates/eval_cli/src/main.rs b/crates/eval_cli/src/main.rs index 7677f04e413..1207173df45 100644 --- a/crates/eval_cli/src/main.rs +++ b/crates/eval_cli/src/main.rs @@ -480,7 +480,7 @@ fn find_available_model(selected: &SelectedModel, cx: &gpui::App) -> Option, - pub content: Option, -} - #[cfg(test)] mod tests { use super::*; diff --git a/crates/language_models/src/provider/bedrock.rs b/crates/language_models/src/provider/bedrock.rs index 184c17fa079..765ee82c139 100644 --- a/crates/language_models/src/provider/bedrock.rs +++ b/crates/language_models/src/provider/bedrock.rs @@ -1692,10 +1692,8 @@ impl MantleResponseEventMapper { // suffix. if snapshot.starts_with(&previous.text) && snapshot.len() > previous.text.len() { - if let Some(current_message) = self.current_message.as_mut() { - current_message.kind = MantleMessageSnapshotKind::Cumulative; - current_message.emitted_text_length = previous.text.len(); - } + current_message.kind = MantleMessageSnapshotKind::Cumulative; + current_message.emitted_text_length = previous.text.len(); let mut events = Vec::new(); self.flush_pending_message(&mut events, true); events.extend(self.map_snapshot_suffix(output_index, content_index)); @@ -1713,9 +1711,7 @@ impl MantleResponseEventMapper { // Diverged from the previous message, had a different phase, or there // was no previous message: this is an independent message. - if let Some(current_message) = self.current_message.as_mut() { - current_message.kind = MantleMessageSnapshotKind::Independent; - } + current_message.kind = MantleMessageSnapshotKind::Independent; let mut events = Vec::new(); self.flush_pending_message(&mut events, false); events.extend(self.map_text_event(item_id, output_index, content_index, snapshot)); diff --git a/crates/language_models/src/provider/cloud.rs b/crates/language_models/src/provider/cloud.rs index 7332a2a01f1..62be34d28dc 100644 --- a/crates/language_models/src/provider/cloud.rs +++ b/crates/language_models/src/provider/cloud.rs @@ -241,7 +241,7 @@ impl CloudLanguageModelProvider { let maintain_client_status = cx.spawn(async move |cx| { while let Some(status) = status_rx.next().await { if let Some(this) = state_ref.upgrade() { - _ = this.update(cx, |this, cx| { + this.update(cx, |this, cx| { if this.status != status { this.status = status; if status.is_signed_out() { diff --git a/crates/language_models/src/provider/open_router.rs b/crates/language_models/src/provider/open_router.rs index 353c92297d1..93eca4928de 100644 --- a/crates/language_models/src/provider/open_router.rs +++ b/crates/language_models/src/provider/open_router.rs @@ -70,10 +70,10 @@ impl State { ); cx.spawn(async move |this, cx| { - let result = task.await?; + task.await?; this.update(cx, |this, cx| this.restart_fetch_models_task(cx)) .ok(); - Ok(result) + Ok(()) }) } diff --git a/crates/lmstudio/src/lmstudio.rs b/crates/lmstudio/src/lmstudio.rs index f977a7018a6..7a6b193b933 100644 --- a/crates/lmstudio/src/lmstudio.rs +++ b/crates/lmstudio/src/lmstudio.rs @@ -70,7 +70,6 @@ pub enum ToolChoice { #[derive(Clone, Deserialize, Serialize, Debug)] #[serde(tag = "type", rename_all = "snake_case")] pub enum ToolDefinition { - #[allow(dead_code)] Function { function: FunctionDefinition }, } diff --git a/crates/ollama/src/ollama.rs b/crates/ollama/src/ollama.rs index 196160e6676..14c60ef8876 100644 --- a/crates/ollama/src/ollama.rs +++ b/crates/ollama/src/ollama.rs @@ -177,14 +177,6 @@ pub struct LocalModelListing { pub details: ModelDetails, } -#[derive(Serialize, Deserialize)] -pub struct LocalModel { - pub modelfile: String, - pub parameters: String, - pub template: String, - pub details: ModelDetails, -} - #[derive(Serialize, Deserialize)] pub struct ModelDetails { pub format: String, diff --git a/crates/open_ai/src/open_ai.rs b/crates/open_ai/src/open_ai.rs index 883b11feb3e..7aa8e2a7817 100644 --- a/crates/open_ai/src/open_ai.rs +++ b/crates/open_ai/src/open_ai.rs @@ -815,7 +815,6 @@ pub enum ToolChoice { #[derive(Clone, Deserialize, Serialize, Debug)] #[serde(tag = "type", rename_all = "snake_case")] pub enum ToolDefinition { - #[allow(dead_code)] Function { function: FunctionDefinition }, } diff --git a/crates/open_router/src/open_router.rs b/crates/open_router/src/open_router.rs index 6272e063a3d..1bc7eb36838 100644 --- a/crates/open_router/src/open_router.rs +++ b/crates/open_router/src/open_router.rs @@ -203,7 +203,6 @@ pub enum ToolChoice { #[derive(Clone, Deserialize, Serialize, Debug)] #[serde(tag = "type", rename_all = "snake_case")] pub enum ToolDefinition { - #[allow(dead_code)] Function { function: FunctionDefinition }, } @@ -305,39 +304,6 @@ impl From<&str> for MessageContent { } } -impl MessageContent { - pub fn as_text(&self) -> Option<&str> { - match self { - Self::Plain(text) => Some(text), - Self::Multipart(parts) if parts.len() == 1 => { - if let MessagePart::Text { text, .. } = &parts[0] { - Some(text) - } else { - None - } - } - _ => None, - } - } - - pub fn to_text(&self) -> String { - match self { - Self::Plain(text) => text.clone(), - Self::Multipart(parts) => parts - .iter() - .filter_map(|part| { - if let MessagePart::Text { text, .. } = part { - Some(text.as_str()) - } else { - None - } - }) - .collect::>() - .concat(), - } - } -} - #[derive(Debug, Serialize, Deserialize, Copy, Clone, Eq, PartialEq)] #[serde(rename_all = "lowercase")] pub enum CacheControlType { diff --git a/crates/prompt_store/src/prompt_store.rs b/crates/prompt_store/src/prompt_store.rs index df270bb0a42..fa3a5d1eb5a 100644 --- a/crates/prompt_store/src/prompt_store.rs +++ b/crates/prompt_store/src/prompt_store.rs @@ -111,10 +111,6 @@ impl PromptId { Self::BuiltIn(builtin) => Some(*builtin), } } - - pub fn is_built_in(&self) -> bool { - matches!(self, Self::BuiltIn { .. }) - } } impl From for PromptId { diff --git a/crates/web_search/src/web_search.rs b/crates/web_search/src/web_search.rs index c381b91f394..57200c00d83 100644 --- a/crates/web_search/src/web_search.rs +++ b/crates/web_search/src/web_search.rs @@ -45,11 +45,6 @@ impl WebSearchRegistry { self.active_provider.clone() } - pub fn set_active_provider(&mut self, provider: Arc) { - self.active_provider = Some(provider.clone()); - self.providers.insert(provider.id(), provider); - } - pub fn register_provider( &mut self, provider: T, diff --git a/crates/zed_credentials_provider/src/zed_credentials_provider.rs b/crates/zed_credentials_provider/src/zed_credentials_provider.rs index 7d71dff9a31..5ae83e65fba 100644 --- a/crates/zed_credentials_provider/src/zed_credentials_provider.rs +++ b/crates/zed_credentials_provider/src/zed_credentials_provider.rs @@ -29,9 +29,6 @@ impl Global for ZedCredentialsProvider {} /// Returns the global [`CredentialsProvider`]. pub fn init_global(cx: &mut App) { - // The `CredentialsProvider` trait has `Send + Sync` bounds on it, so it - // seems like this is a false positive from Clippy. - #[allow(clippy::arc_with_non_send_sync)] let provider = new(cx); cx.set_global(ZedCredentialsProvider(provider)); }