diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs index 185eed3cd7a89c8c0dad17979e34c7ffc5684e08..dd68051fcfcabe7ba063c97ea15942fd47ba1c58 100644 --- a/crates/acp_thread/src/acp_thread.rs +++ b/crates/acp_thread/src/acp_thread.rs @@ -573,7 +573,7 @@ impl ToolCallContent { ))), acp::ToolCallContent::Diff { diff } => Ok(Self::Diff(cx.new(|cx| { Diff::finalized( - diff.path.to_string_lossy().to_string(), + diff.path.to_string_lossy().into_owned(), diff.old_text, diff.new_text, language_registry, diff --git a/crates/agent/src/context.rs b/crates/agent/src/context.rs index 80062b1e46f01d1740359e6832c73a2aec255031..3b2922087a94c497c07f1df67a8d4d9adf759909 100644 --- a/crates/agent/src/context.rs +++ b/crates/agent/src/context.rs @@ -187,7 +187,7 @@ impl FileContextHandle { log::error!("file context missing path"); return Task::ready(None); }; - let full_path = file.full_path(cx).to_string_lossy().to_string(); + let full_path = file.full_path(cx).to_string_lossy().into_owned(); let rope = buffer_ref.as_rope().clone(); let buffer = self.buffer.clone(); @@ -283,7 +283,7 @@ impl DirectoryContextHandle { let descendants_future = future::join_all(file_paths.into_iter().map(|path| { let worktree_ref = worktree.read(cx); let worktree_id = worktree_ref.id(); - let full_path = worktree_ref.full_path(&path).to_string_lossy().to_string(); + let full_path = worktree_ref.full_path(&path).to_string_lossy().into_owned(); let rel_path = path .strip_prefix(&directory_path) @@ -403,7 +403,7 @@ impl SymbolContextHandle { log::error!("symbol context's file has no path"); return Task::ready(None); }; - let full_path = file.full_path(cx).to_string_lossy().to_string(); + let full_path = file.full_path(cx).to_string_lossy().into_owned(); let line_range = self.enclosing_range.to_point(&buffer_ref.snapshot()); let text = self.text(cx); let buffer = self.buffer.clone(); @@ -476,7 +476,7 @@ impl SelectionContextHandle { let text = self.text(cx); let buffer = self.buffer.clone(); let context = AgentContext::Selection(SelectionContext { - full_path: full_path.to_string_lossy().to_string(), + full_path: full_path.to_string_lossy().into_owned(), line_range: self.line_range(cx), text, handle: self, diff --git a/crates/agent/src/context_store.rs b/crates/agent/src/context_store.rs index c4aa0abc25544e943e0e91c3a95c8dd8fafad8ef..cf35840cc4215695a966931701257c838c00af18 100644 --- a/crates/agent/src/context_store.rs +++ b/crates/agent/src/context_store.rs @@ -312,7 +312,7 @@ impl ContextStore { let item = image_item.read(cx); this.insert_image( Some(item.project_path(cx)), - Some(item.file.full_path(cx).to_string_lossy().to_string()), + Some(item.file.full_path(cx).to_string_lossy().into_owned()), item.image.clone(), remove_if_exists, cx, diff --git a/crates/agent/src/history_store.rs b/crates/agent/src/history_store.rs index 285ce7c04b7268aea24e0a746737f65d7c3608df..4b1795047b7444dc74f8a41097c0c66aa54ecfd9 100644 --- a/crates/agent/src/history_store.rs +++ b/crates/agent/src/history_store.rs @@ -155,7 +155,7 @@ impl HistoryStore { .iter() .filter_map(|entry| match entry { HistoryEntryId::Context(path) => path.file_name().map(|file| { - SerializedRecentOpen::ContextName(file.to_string_lossy().to_string()) + SerializedRecentOpen::ContextName(file.to_string_lossy().into_owned()) }), HistoryEntryId::Thread(id) => Some(SerializedRecentOpen::Thread(id.to_string())), }) diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index 0790e8b2894dc5495cd46585a315696118afd33a..afeb3ea4be5f3cf233040e26dd0e754a10952188 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -2875,7 +2875,7 @@ impl Thread { // Get worktree path and snapshot let worktree_info = cx.update(|app_cx| { let worktree = worktree.read(app_cx); - let path = worktree.abs_path().to_string_lossy().to_string(); + let path = worktree.abs_path().to_string_lossy().into_owned(); let snapshot = worktree.snapshot(); (path, snapshot) }); diff --git a/crates/agent2/src/history_store.rs b/crates/agent2/src/history_store.rs index c656456e01780505c355c878c26d2405286e56b2..ff6caacc78e5dba4ee38f160fa6ded7fcb45a845 100644 --- a/crates/agent2/src/history_store.rs +++ b/crates/agent2/src/history_store.rs @@ -262,7 +262,7 @@ impl HistoryStore { .iter() .filter_map(|entry| match entry { HistoryEntryId::TextThread(path) => path.file_name().map(|file| { - SerializedRecentOpen::TextThread(file.to_string_lossy().to_string()) + SerializedRecentOpen::TextThread(file.to_string_lossy().into_owned()) }), HistoryEntryId::AcpThread(id) => { Some(SerializedRecentOpen::AcpThread(id.to_string())) diff --git a/crates/agent2/src/thread.rs b/crates/agent2/src/thread.rs index 630b4f906904df2410716f35ef7d15aa0f706e8b..7a991422838305e089dea453c294825e0f1c6e5b 100644 --- a/crates/agent2/src/thread.rs +++ b/crates/agent2/src/thread.rs @@ -898,7 +898,7 @@ impl Thread { // Get worktree path and snapshot let worktree_info = cx.update(|app_cx| { let worktree = worktree.read(app_cx); - let path = worktree.abs_path().to_string_lossy().to_string(); + let path = worktree.abs_path().to_string_lossy().into_owned(); let snapshot = worktree.snapshot(); (path, snapshot) }); diff --git a/crates/agent2/src/tools/edit_file_tool.rs b/crates/agent2/src/tools/edit_file_tool.rs index 3b1bf6f408e88ed0e6bf80b0b55815d122ab1854..7c51df0fae274e2d5906aa73e70c30105b1a2353 100644 --- a/crates/agent2/src/tools/edit_file_tool.rs +++ b/crates/agent2/src/tools/edit_file_tool.rs @@ -218,7 +218,7 @@ impl AgentTool for EditFileTool { .read(cx) .short_full_path_for_project_path(&project_path, cx) }) - .unwrap_or(input.path.to_string_lossy().to_string()) + .unwrap_or(input.path.to_string_lossy().into_owned()) .into(), Err(raw_input) => { if let Some(input) = @@ -476,7 +476,7 @@ impl AgentTool for EditFileTool { ) -> Result<()> { event_stream.update_diff(cx.new(|cx| { Diff::finalized( - output.input_path.to_string_lossy().to_string(), + output.input_path.to_string_lossy().into_owned(), Some(output.old_text.to_string()), output.new_text, self.language_registry.clone(), diff --git a/crates/agent2/src/tools/open_tool.rs b/crates/agent2/src/tools/open_tool.rs index 595a9f380b752635f97ef5d1819a1140c1db8be0..b98ae9af3bd98cd44bc9348e72519ceea53c6292 100644 --- a/crates/agent2/src/tools/open_tool.rs +++ b/crates/agent2/src/tools/open_tool.rs @@ -104,7 +104,7 @@ mod tests { async fn test_to_absolute_path(cx: &mut TestAppContext) { init_test(cx); let temp_dir = TempDir::new().expect("Failed to create temp directory"); - let temp_path = temp_dir.path().to_string_lossy().to_string(); + let temp_path = temp_dir.path().to_string_lossy().into_owned(); let fs = FakeFs::new(cx.executor()); fs.insert_tree( diff --git a/crates/agent_servers/src/claude.rs b/crates/agent_servers/src/claude.rs index 4646b2e8259fa2cd63c0daa67b47f66b5e78af05..b84a386679cee825be22d895634a6971b537fa89 100644 --- a/crates/agent_servers/src/claude.rs +++ b/crates/agent_servers/src/claude.rs @@ -62,7 +62,7 @@ impl AgentServer for ClaudeCode { cx: &mut App, ) -> Task, Option)>> { let name = self.name(); - let root_dir = root_dir.map(|root_dir| root_dir.to_string_lossy().to_string()); + let root_dir = root_dir.map(|root_dir| root_dir.to_string_lossy().into_owned()); let is_remote = delegate.project.read(cx).is_via_remote_server(); let store = delegate.store.downgrade(); let extra_env = load_proxy_env(cx); diff --git a/crates/agent_servers/src/custom.rs b/crates/agent_servers/src/custom.rs index cb9a6dba3c6376fa5030c21523c86853c9b6d761..406a18965111a44bc4e78469b20aaf199cbda037 100644 --- a/crates/agent_servers/src/custom.rs +++ b/crates/agent_servers/src/custom.rs @@ -67,7 +67,7 @@ impl crate::AgentServer for CustomAgentServer { cx: &mut App, ) -> Task, Option)>> { let name = self.name(); - let root_dir = root_dir.map(|root_dir| root_dir.to_string_lossy().to_string()); + let root_dir = root_dir.map(|root_dir| root_dir.to_string_lossy().into_owned()); let is_remote = delegate.project.read(cx).is_via_remote_server(); let default_mode = self.default_mode(cx); let store = delegate.store.downgrade(); diff --git a/crates/agent_servers/src/gemini.rs b/crates/agent_servers/src/gemini.rs index 9407a42e68d34e38e78f2103b29f980f874fb3db..8004f5caec4a7bd2e3e6b1d9a885f4943fa21147 100644 --- a/crates/agent_servers/src/gemini.rs +++ b/crates/agent_servers/src/gemini.rs @@ -31,7 +31,7 @@ impl AgentServer for Gemini { cx: &mut App, ) -> Task, Option)>> { let name = self.name(); - let root_dir = root_dir.map(|root_dir| root_dir.to_string_lossy().to_string()); + let root_dir = root_dir.map(|root_dir| root_dir.to_string_lossy().into_owned()); let is_remote = delegate.project.read(cx).is_via_remote_server(); let store = delegate.store.downgrade(); let mut extra_env = load_proxy_env(cx); diff --git a/crates/agent_ui/src/terminal_inline_assistant.rs b/crates/agent_ui/src/terminal_inline_assistant.rs index e7070c0d7fc4878c1f73a6d5f874607422ae53d6..4385d2420511c8a148b2a7a58fa8845bd2c19a07 100644 --- a/crates/agent_ui/src/terminal_inline_assistant.rs +++ b/crates/agent_ui/src/terminal_inline_assistant.rs @@ -238,7 +238,7 @@ impl TerminalInlineAssistant { let latest_output = terminal.last_n_non_empty_lines(DEFAULT_CONTEXT_LINES); let working_directory = terminal .working_directory() - .map(|path| path.to_string_lossy().to_string()); + .map(|path| path.to_string_lossy().into_owned()); (latest_output, working_directory) }) .ok() diff --git a/crates/assistant_slash_command/src/extension_slash_command.rs b/crates/assistant_slash_command/src/extension_slash_command.rs index 301cf65cb45895ff2475b74510264260d827da61..6dd2c05f192358f9fcd843add21df94e301dc6b7 100644 --- a/crates/assistant_slash_command/src/extension_slash_command.rs +++ b/crates/assistant_slash_command/src/extension_slash_command.rs @@ -50,7 +50,7 @@ impl WorktreeDelegate for WorktreeDelegateAdapter { } fn root_path(&self) -> String { - self.0.worktree_root_path().to_string_lossy().to_string() + self.0.worktree_root_path().to_string_lossy().into_owned() } async fn read_text_file(&self, path: &RelPath) -> Result { @@ -61,7 +61,7 @@ impl WorktreeDelegate for WorktreeDelegateAdapter { self.0 .which(binary_name.as_ref()) .await - .map(|path| path.to_string_lossy().to_string()) + .map(|path| path.to_string_lossy().into_owned()) } async fn shell_env(&self) -> Vec<(String, String)> { diff --git a/crates/assistant_slash_commands/src/selection_command.rs b/crates/assistant_slash_commands/src/selection_command.rs index 068a66339b9a3c8619e1050feb4d70b32f97f657..c8692dec718a03af777753f35ae646f245878ed9 100644 --- a/crates/assistant_slash_commands/src/selection_command.rs +++ b/crates/assistant_slash_commands/src/selection_command.rs @@ -139,7 +139,7 @@ pub fn selections_creases( let language_name = language_name.as_deref().unwrap_or(""); let filename = snapshot .file_at(range.start) - .map(|file| file.full_path(cx).to_string_lossy().to_string()); + .map(|file| file.full_path(cx).to_string_lossy().into_owned()); let text = if language_name == "markdown" { selected_text .lines() diff --git a/crates/assistant_tools/src/find_path_tool.rs b/crates/assistant_tools/src/find_path_tool.rs index 53da3106d2f9fa5fd7928b4291cc8e80daa3bfdb..0bc478251cb5d3d558dda4fb41df02e85eaafde2 100644 --- a/crates/assistant_tools/src/find_path_tool.rs +++ b/crates/assistant_tools/src/find_path_tool.rs @@ -262,7 +262,7 @@ impl ToolCard for FindPathToolCard { .children(self.paths.iter().enumerate().map(|(index, path)| { let path_clone = path.clone(); let workspace_clone = workspace.clone(); - let button_label = path.to_string_lossy().to_string(); + let button_label = path.to_string_lossy().into_owned(); Button::new(("path", index), button_label) .icon(IconName::ArrowUpRight) diff --git a/crates/assistant_tools/src/open_tool.rs b/crates/assistant_tools/src/open_tool.rs index 6dbf66749b932804df6e00fed726360f0492c7f3..a1aafad041364b0ffca01cc1890c2cc10b3d7b01 100644 --- a/crates/assistant_tools/src/open_tool.rs +++ b/crates/assistant_tools/src/open_tool.rs @@ -104,7 +104,7 @@ mod tests { async fn test_to_absolute_path(cx: &mut TestAppContext) { init_test(cx); let temp_dir = TempDir::new().expect("Failed to create temp directory"); - let temp_path = temp_dir.path().to_string_lossy().to_string(); + let temp_path = temp_dir.path().to_string_lossy().into_owned(); let fs = FakeFs::new(cx.executor()); fs.insert_tree( diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 8cf17c1cd1045009b25e203b3a97c8c02ed8b9f8..de45ae44fccef1bde25c5d8216261c3847943589 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -143,7 +143,7 @@ fn parse_path_with_position(argument_str: &str) -> anyhow::Result { } .with_context(|| format!("parsing as path with position {argument_str}"))?, }; - Ok(canonicalized.to_string(|path| path.to_string_lossy().to_string())) + Ok(canonicalized.to_string(|path| path.to_string_lossy().into_owned())) } fn parse_path_in_wsl(source: &str, wsl: &str) -> Result { @@ -320,12 +320,12 @@ fn main() -> Result<()> { urls.push(path.to_string()); } else if path == "-" && args.paths_with_position.len() == 1 { let file = NamedTempFile::new()?; - paths.push(file.path().to_string_lossy().to_string()); + paths.push(file.path().to_string_lossy().into_owned()); let (file, _) = file.keep()?; stdin_tmp_file = Some(file); } else if let Some(file) = anonymous_fd(path) { let tmp_file = NamedTempFile::new()?; - paths.push(tmp_file.path().to_string_lossy().to_string()); + paths.push(tmp_file.path().to_string_lossy().into_owned()); let (tmp_file, _) = tmp_file.keep()?; anonymous_fd_tmp_files.push((file, tmp_file)); } else if let Some(wsl) = wsl { diff --git a/crates/context_server/src/client.rs b/crates/context_server/src/client.rs index 7dc174bfaab4770ff90623f048223fc2177acde9..f891e96250f3334540aa859fe438c87297fc0100 100644 --- a/crates/context_server/src/client.rs +++ b/crates/context_server/src/client.rs @@ -172,7 +172,7 @@ impl Client { let server_name = binary .executable .file_name() - .map(|name| name.to_string_lossy().to_string()) + .map(|name| name.to_string_lossy().into_owned()) .unwrap_or_else(String::new); let timeout = binary.timeout.map(Duration::from_millis); diff --git a/crates/dap/src/adapters.rs b/crates/dap/src/adapters.rs index b952a603c786a240feb09264ba834f62df261386..403c0034fffb79c959d9a30cd4bd9fadbc306f85 100644 --- a/crates/dap/src/adapters.rs +++ b/crates/dap/src/adapters.rs @@ -238,7 +238,7 @@ impl DebugAdapterBinary { cwd: self .cwd .as_ref() - .map(|cwd| cwd.to_string_lossy().to_string()), + .map(|cwd| cwd.to_string_lossy().into_owned()), connection: self.connection.as_ref().map(|c| c.to_proto()), launch_type: match self.request_args.request { StartDebuggingRequestArgumentsRequest::Launch => { diff --git a/crates/dap_adapters/src/codelldb.rs b/crates/dap_adapters/src/codelldb.rs index 25dc875740e8aba87872e8dc93fa8d77062ed545..64c32b387d5c8d764632774930d11f1db884970c 100644 --- a/crates/dap_adapters/src/codelldb.rs +++ b/crates/dap_adapters/src/codelldb.rs @@ -332,7 +332,7 @@ impl DebugAdapter for CodeLldbDebugAdapter { _: &mut AsyncApp, ) -> Result { let mut command = user_installed_path - .map(|p| p.to_string_lossy().to_string()) + .map(|p| p.to_string_lossy().into_owned()) .or(self.path_to_codelldb.get().cloned()); if command.is_none() { @@ -372,7 +372,7 @@ impl DebugAdapter for CodeLldbDebugAdapter { } }; let adapter_dir = version_path.join("extension").join("adapter"); - let path = adapter_dir.join("codelldb").to_string_lossy().to_string(); + let path = adapter_dir.join("codelldb").to_string_lossy().into_owned(); self.path_to_codelldb.set(path.clone()).ok(); command = Some(path); }; diff --git a/crates/dap_adapters/src/go.rs b/crates/dap_adapters/src/go.rs index db8a45ceb49963eab053f3e7728d4cf715e9a40b..999909ad44f313d413ecaa3990f9816872bae588 100644 --- a/crates/dap_adapters/src/go.rs +++ b/crates/dap_adapters/src/go.rs @@ -415,11 +415,11 @@ impl DebugAdapter for GoDebugAdapter { let dlv_path = adapter_path.join("dlv"); let delve_path = if let Some(path) = user_installed_path { - path.to_string_lossy().to_string() + path.to_string_lossy().into_owned() } else if let Some(path) = delegate.which(OsStr::new("dlv")).await { - path.to_string_lossy().to_string() + path.to_string_lossy().into_owned() } else if delegate.fs().is_file(&dlv_path).await { - dlv_path.to_string_lossy().to_string() + dlv_path.to_string_lossy().into_owned() } else { let go = delegate .which(OsStr::new("go")) @@ -443,7 +443,7 @@ impl DebugAdapter for GoDebugAdapter { ); } - adapter_path.join("dlv").to_string_lossy().to_string() + adapter_path.join("dlv").to_string_lossy().into_owned() }; let cwd = Some( diff --git a/crates/dap_adapters/src/javascript.rs b/crates/dap_adapters/src/javascript.rs index a8826d563b09925068dd6da1be865f1e17bce0ec..9a19b9594948bca7b5a1c7b77bdc1ec3a6f83dd6 100644 --- a/crates/dap_adapters/src/javascript.rs +++ b/crates/dap_adapters/src/javascript.rs @@ -138,11 +138,11 @@ impl JsDebugAdapter { }; let arguments = if let Some(mut args) = user_args { - args.insert(0, adapter_path.to_string_lossy().to_string()); + args.insert(0, adapter_path.to_string_lossy().into_owned()); args } else { vec![ - adapter_path.to_string_lossy().to_string(), + adapter_path.to_string_lossy().into_owned(), port.to_string(), host.to_string(), ] diff --git a/crates/dap_adapters/src/python.rs b/crates/dap_adapters/src/python.rs index 5a6bd729ce4cf174822f7977fd0e86b826d45601..47aec4aa5b1a39a517b7887828200ebf4bd065d4 100644 --- a/crates/dap_adapters/src/python.rs +++ b/crates/dap_adapters/src/python.rs @@ -46,7 +46,7 @@ impl PythonDebugAdapter { "Using user-installed debugpy adapter from: {}", user_installed_path.display() ); - vec![user_installed_path.to_string_lossy().to_string()] + vec![user_installed_path.to_string_lossy().into_owned()] } else { let adapter_path = paths::debug_adapters_dir().join(Self::DEBUG_ADAPTER_NAME.as_ref()); let path = adapter_path @@ -264,7 +264,7 @@ impl PythonDebugAdapter { name = delegate .which(OsStr::new(cmd)) .await - .map(|path| path.to_string_lossy().to_string()); + .map(|path| path.to_string_lossy().into_owned()); if name.is_some() { break; } diff --git a/crates/debug_adapter_extension/src/extension_dap_adapter.rs b/crates/debug_adapter_extension/src/extension_dap_adapter.rs index be225a0c44682f41f7c071641cd4df07798370c8..3a39027b62963aa99b53b09ab621f91a1b3f95c5 100644 --- a/crates/debug_adapter_extension/src/extension_dap_adapter.rs +++ b/crates/debug_adapter_extension/src/extension_dap_adapter.rs @@ -55,7 +55,7 @@ impl WorktreeDelegate for WorktreeDelegateAdapter { } fn root_path(&self) -> String { - self.0.worktree_root_path().to_string_lossy().to_string() + self.0.worktree_root_path().to_string_lossy().into_owned() } async fn read_text_file(&self, path: &RelPath) -> Result { @@ -66,7 +66,7 @@ impl WorktreeDelegate for WorktreeDelegateAdapter { self.0 .which(binary_name.as_ref()) .await - .map(|path| path.to_string_lossy().to_string()) + .map(|path| path.to_string_lossy().into_owned()) } async fn shell_env(&self) -> Vec<(String, String)> { diff --git a/crates/debugger_ui/src/attach_modal.rs b/crates/debugger_ui/src/attach_modal.rs index 8926b3bb6f61e6e612f75777584810fa24b616ba..daa83f71b1c4148398e12f491caf46b5bf556919 100644 --- a/crates/debugger_ui/src/attach_modal.rs +++ b/crates/debugger_ui/src/attach_modal.rs @@ -373,7 +373,7 @@ fn get_processes_for_project(project: &Entity, cx: &mut App) -> Task>(), } }) diff --git a/crates/debugger_ui/src/new_process_modal.rs b/crates/debugger_ui/src/new_process_modal.rs index cb8edb88b5d108a48d919bb17cb1f320a6c9bdaa..56c4a690325a0f5d8387fa76c1121206ff8f05fb 100644 --- a/crates/debugger_ui/src/new_process_modal.rs +++ b/crates/debugger_ui/src/new_process_modal.rs @@ -1578,7 +1578,7 @@ impl PickerDelegate for DebugDelegate { pub(crate) fn resolve_path(path: &mut String) { if path.starts_with('~') { - let home = paths::home_dir().to_string_lossy().to_string(); + let home = paths::home_dir().to_string_lossy().into_owned(); let trimmed_path = path.trim().to_owned(); *path = trimmed_path.replacen('~', &home, 1); } else if let Some(strip_path) = path.strip_prefix(&format!(".{}", std::path::MAIN_SEPARATOR)) { diff --git a/crates/debugger_ui/src/tests/debugger_panel.rs b/crates/debugger_ui/src/tests/debugger_panel.rs index 05de4a47a4ec3c0762a8ebe1318b37f8a812a6d2..342adfa149bb56f8830b1d10d2b096598aa40c29 100644 --- a/crates/debugger_ui/src/tests/debugger_panel.rs +++ b/crates/debugger_ui/src/tests/debugger_panel.rs @@ -351,7 +351,7 @@ async fn test_handle_successful_run_in_terminal_reverse_request( .fake_reverse_request::(RunInTerminalRequestArguments { kind: None, title: None, - cwd: std::env::temp_dir().to_string_lossy().to_string(), + cwd: std::env::temp_dir().to_string_lossy().into_owned(), args: vec![], env: None, args_can_be_interpreted_by_shell: None, diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 51734da461a7d6dc7601576f456a9a5f75b7d7e6..d2673a1d05cca3704034a75f9baf0eee114f4b99 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -6427,37 +6427,36 @@ impl Editor { buffer.read(cx).file().map(|f| f.path().clone()) }); })?; + if entries.is_empty() { + return Ok(()); + } // If the project transaction's edits are all contained within this editor, then // avoid opening a new editor to display them. - if let Some((buffer, transaction)) = entries.first() { - if entries.len() == 1 { - let excerpt = editor.update(cx, |editor, cx| { - editor - .buffer() - .read(cx) - .excerpt_containing(editor.selections.newest_anchor().head(), cx) + if let [(buffer, transaction)] = &*entries { + let excerpt = editor.update(cx, |editor, cx| { + editor + .buffer() + .read(cx) + .excerpt_containing(editor.selections.newest_anchor().head(), cx) + })?; + if let Some((_, excerpted_buffer, excerpt_range)) = excerpt + && excerpted_buffer == *buffer + { + let all_edits_within_excerpt = buffer.read_with(cx, |buffer, _| { + let excerpt_range = excerpt_range.to_offset(buffer); + buffer + .edited_ranges_for_transaction::(transaction) + .all(|range| { + excerpt_range.start <= range.start && excerpt_range.end >= range.end + }) })?; - if let Some((_, excerpted_buffer, excerpt_range)) = excerpt - && excerpted_buffer == *buffer - { - let all_edits_within_excerpt = buffer.read_with(cx, |buffer, _| { - let excerpt_range = excerpt_range.to_offset(buffer); - buffer - .edited_ranges_for_transaction::(transaction) - .all(|range| { - excerpt_range.start <= range.start && excerpt_range.end >= range.end - }) - })?; - if all_edits_within_excerpt { - return Ok(()); - } + if all_edits_within_excerpt { + return Ok(()); } } - } else { - return Ok(()); } let mut ranges_to_highlight = Vec::new(); diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index aaaee35eec33da8acad2531d6cd016fab9436803..6b99b30757318b21208ab948cb85d651e33fd78c 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -4030,7 +4030,7 @@ impl EditorElement { Some(Box::new(zed_actions::workspace::CopyPath)), window.handler_for(&editor, move |_, _, cx| { cx.write_to_clipboard(ClipboardItem::new_string( - abs_path.to_string_lossy().to_string(), + abs_path.to_string_lossy().into_owned(), )); }), ) diff --git a/crates/editor/src/items.rs b/crates/editor/src/items.rs index e8ce3b81f3e2fa958dd7839edbbdde9d5fc00667..08174158edafe917402fc8603716351cd7b6d50b 100644 --- a/crates/editor/src/items.rs +++ b/crates/editor/src/items.rs @@ -640,7 +640,7 @@ impl Item for Editor { .and_then(|f| f.as_local())? .abs_path(cx); - let file_path = file_path.compact().to_string_lossy().to_string(); + let file_path = file_path.compact().to_string_lossy().into_owned(); Some(file_path.into()) } @@ -1909,7 +1909,7 @@ fn path_for_file<'a>( return None; } } - Some(full_path.to_string_lossy().to_string().into()) + Some(full_path.to_string_lossy().into_owned().into()) } else { let mut path = file.path().strip_prefix(prefix).ok()?; if !include_filename { diff --git a/crates/editor/src/persistence.rs b/crates/editor/src/persistence.rs index ec7c149b4e107600c35e70ef3dffcdb2e8f8bcb7..c977efc7a4aa3ac3de65e21e3707f015bf007e2a 100644 --- a/crates/editor/src/persistence.rs +++ b/crates/editor/src/persistence.rs @@ -35,7 +35,7 @@ impl Bind for SerializedEditor { &self .abs_path .as_ref() - .map(|p| p.to_string_lossy().to_string()), + .map(|p| p.to_string_lossy().into_owned()), start_index, )?; let start_index = statement.bind(&self.contents, start_index)?; diff --git a/crates/eval/src/examples/mod.rs b/crates/eval/src/examples/mod.rs index 6d47513e373f44b011743c398556a709cf71348e..afe258aa76b1abb5406ce212af4f223c56cb2020 100644 --- a/crates/eval/src/examples/mod.rs +++ b/crates/eval/src/examples/mod.rs @@ -106,7 +106,7 @@ impl DeclarativeExample { } pub fn name_from_path(path: &Path) -> String { - path.file_stem().unwrap().to_string_lossy().to_string() + path.file_stem().unwrap().to_string_lossy().into_owned() } } diff --git a/crates/eval/src/instance.rs b/crates/eval/src/instance.rs index d0fd98d0280c2f539a67de009a0335b5ae479027..208147e2f04b26a7337c071d36f4f687ca0fe184 100644 --- a/crates/eval/src/instance.rs +++ b/crates/eval/src/instance.rs @@ -164,7 +164,7 @@ impl ExampleInstance { } else { println!("{}Creating worktree", self.log_prefix); - let worktree_path_string = worktree_path.to_string_lossy().to_string(); + let worktree_path_string = worktree_path.to_string_lossy().into_owned(); run_git( &self.repo_path, diff --git a/crates/explorer_command_injector/src/explorer_command_injector.rs b/crates/explorer_command_injector/src/explorer_command_injector.rs index 131a9534be1d67e7494216606a57110a50c28fc4..bfa2a0326c9975037ed860acfdee7cd32e3075d8 100644 --- a/crates/explorer_command_injector/src/explorer_command_injector.rs +++ b/crates/explorer_command_injector/src/explorer_command_injector.rs @@ -181,7 +181,7 @@ fn get_zed_install_folder() -> Option { #[inline] fn get_zed_exe_path() -> Option { - get_zed_install_folder().map(|path| path.join("Zed.exe").to_string_lossy().to_string()) + get_zed_install_folder().map(|path| path.join("Zed.exe").to_string_lossy().into_owned()) } #[inline] diff --git a/crates/extension_host/src/wasm_host/wit/since_v0_6_0.rs b/crates/extension_host/src/wasm_host/wit/since_v0_6_0.rs index b43ea0a6332bd7121059cb3658a595a83df9e0ef..9942f8aeea04b8c466f5d16fc82ae7545b8bb7b1 100644 --- a/crates/extension_host/src/wasm_host/wit/since_v0_6_0.rs +++ b/crates/extension_host/src/wasm_host/wit/since_v0_6_0.rs @@ -724,7 +724,7 @@ impl nodejs::Host for WasmState { .node_runtime .binary_path() .await - .map(|path| path.to_string_lossy().to_string()) + .map(|path| path.to_string_lossy().into_owned()) .to_wasmtime_result() } diff --git a/crates/fs/src/fs.rs b/crates/fs/src/fs.rs index a4a01d1162bd65ff0087bfaa1b45567e9af78147..1c74584b9b6bf47a563ce20f20b0516a75cc071f 100644 --- a/crates/fs/src/fs.rs +++ b/crates/fs/src/fs.rs @@ -2642,8 +2642,8 @@ fn atomic_replace>( unsafe { ReplaceFileW( - &HSTRING::from(replaced_file.as_ref().to_string_lossy().to_string()), - &HSTRING::from(replacement_file.as_ref().to_string_lossy().to_string()), + &HSTRING::from(replaced_file.as_ref().to_string_lossy().into_owned()), + &HSTRING::from(replacement_file.as_ref().to_string_lossy().into_owned()), None, REPLACE_FILE_FLAGS::default(), None, diff --git a/crates/git/src/repository.rs b/crates/git/src/repository.rs index 7a8e3514d7433beec3b43f610497257bfa76b1c7..34c17da8ec96948898fedee2a6ef12c471ff25f4 100644 --- a/crates/git/src/repository.rs +++ b/crates/git/src/repository.rs @@ -1869,7 +1869,7 @@ async fn exclude_files(git: &GitBinary) -> Result { if !excluded_paths.is_empty() { let exclude_patterns = excluded_paths .into_iter() - .map(|path| path.to_string_lossy().to_string()) + .map(|path| path.to_string_lossy().into_owned()) .collect::>() .join("\n"); excludes.add_excludes(&exclude_patterns).await?; diff --git a/crates/git_ui/src/file_diff_view.rs b/crates/git_ui/src/file_diff_view.rs index a320888b3b409a79866818887b898ea853eb0609..e24fe4a6e0b5bc400a50410193781a3ce503a3d8 100644 --- a/crates/git_ui/src/file_diff_view.rs +++ b/crates/git_ui/src/file_diff_view.rs @@ -241,7 +241,7 @@ impl Item for FileDiffView { buffer .read(cx) .file() - .map(|file| file.full_path(cx).compact().to_string_lossy().to_string()) + .map(|file| file.full_path(cx).compact().to_string_lossy().into_owned()) .unwrap_or_else(|| "untitled".into()) }; let old_path = path(&self.old_buffer); diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 6ab2b24e2ab4be9d7037d9b5f6d8a446048125d2..e08dc1d1967adf2b05b7d8eaf2a85590ad5bdd01 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -2085,7 +2085,7 @@ impl GitPanel { .to_string() .into() } else { - worktree_abs_path.to_string_lossy().to_string().into() + worktree_abs_path.to_string_lossy().into_owned().into() } }) .collect_vec(); diff --git a/crates/git_ui/src/text_diff_view.rs b/crates/git_ui/src/text_diff_view.rs index bd46a067dc8e6c3aeec4de878709024f66a819f2..8fc4b741daa51e512d155a4aacd736ae3f43f985 100644 --- a/crates/git_ui/src/text_diff_view.rs +++ b/crates/git_ui/src/text_diff_view.rs @@ -193,7 +193,7 @@ impl TextDiffView { .and_then(|b| { b.read(cx) .file() - .map(|f| f.full_path(cx).compact().to_string_lossy().to_string()) + .map(|f| f.full_path(cx).compact().to_string_lossy().into_owned()) }) .unwrap_or("untitled".into()); diff --git a/crates/gpui/examples/animation.rs b/crates/gpui/examples/animation.rs index 6bfe75dd0a51fa5807efc6cd579751460aa8b187..90a8dc57302c91723fc7b2b1927e2ec7c0c8e81d 100644 --- a/crates/gpui/examples/animation.rs +++ b/crates/gpui/examples/animation.rs @@ -21,7 +21,7 @@ impl AssetSource for Assets { Ok(std::fs::read_dir(path)? .filter_map(|entry| { Some(SharedString::from( - entry.ok()?.path().to_string_lossy().to_string(), + entry.ok()?.path().to_string_lossy().into_owned(), )) }) .collect::>()) diff --git a/crates/gpui/examples/image_loading.rs b/crates/gpui/examples/image_loading.rs index 2c4d6e9437191405129e52a3af17a6ac8bcc883d..61fa39407dc14441e0d9dbf1720f3afe398d9970 100644 --- a/crates/gpui/examples/image_loading.rs +++ b/crates/gpui/examples/image_loading.rs @@ -21,7 +21,7 @@ impl AssetSource for Assets { Ok(std::fs::read_dir(path)? .filter_map(|entry| { Some(SharedString::from( - entry.ok()?.path().to_string_lossy().to_string(), + entry.ok()?.path().to_string_lossy().into_owned(), )) }) .collect::>()) diff --git a/crates/image_viewer/src/image_viewer.rs b/crates/image_viewer/src/image_viewer.rs index a9ec858ea3b5e32e093bc5476a4cadc1e64b8501..282ef5c2178d90367c513d6735271dd560cdad32 100644 --- a/crates/image_viewer/src/image_viewer.rs +++ b/crates/image_viewer/src/image_viewer.rs @@ -104,7 +104,7 @@ impl Item for ImageView { fn tab_tooltip_text(&self, cx: &App) -> Option { let abs_path = self.image_item.read(cx).abs_path(cx)?; - let file_path = abs_path.compact().to_string_lossy().to_string(); + let file_path = abs_path.compact().to_string_lossy().into_owned(); Some(file_path.into()) } diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index e6f11d38d21f87a57b109152b4a8567e28f86428..2a9c9ca4276204a08855dd6f08ee7a0b2fcf0068 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -4631,7 +4631,7 @@ impl BufferSnapshot { pub fn resolve_file_path(&self, include_root: bool, cx: &App) -> Option { if let Some(file) = self.file() { if file.path().file_name().is_none() || include_root { - Some(file.full_path(cx).to_string_lossy().to_string()) + Some(file.full_path(cx).to_string_lossy().into_owned()) } else { Some(file.path().display(file.path_style(cx)).to_string()) } diff --git a/crates/language_extension/src/extension_lsp_adapter.rs b/crates/language_extension/src/extension_lsp_adapter.rs index 002b6a15b40575d71e7828ed9fa55dd4c5d1b30a..407b18314f025b7d3b3f43b0735fd0265f6eb9c4 100644 --- a/crates/language_extension/src/extension_lsp_adapter.rs +++ b/crates/language_extension/src/extension_lsp_adapter.rs @@ -33,7 +33,7 @@ impl WorktreeDelegate for WorktreeDelegateAdapter { } fn root_path(&self) -> String { - self.0.worktree_root_path().to_string_lossy().to_string() + self.0.worktree_root_path().to_string_lossy().into_owned() } async fn read_text_file(&self, path: &RelPath) -> Result { @@ -44,7 +44,7 @@ impl WorktreeDelegate for WorktreeDelegateAdapter { self.0 .which(binary_name.as_ref()) .await - .map(|path| path.to_string_lossy().to_string()) + .map(|path| path.to_string_lossy().into_owned()) } async fn shell_env(&self) -> Vec<(String, String)> { diff --git a/crates/languages/src/go.rs b/crates/languages/src/go.rs index 52bd93523c2a9e0257249bd2c4464a589d41f286..55137c942d8ead1569285ccd875c917eef3e5af0 100644 --- a/crates/languages/src/go.rs +++ b/crates/languages/src/go.rs @@ -528,7 +528,7 @@ impl ContextProvider for GoContextProvider { let module_dir = buffer_dir .ancestors() .find(|dir| dir.join("go.mod").is_file()) - .map(|dir| dir.to_string_lossy().to_string()) + .map(|dir| dir.to_string_lossy().into_owned()) .unwrap_or_else(|| ".".to_string()); (GO_MODULE_ROOT_TASK_VARIABLE.clone(), module_dir) diff --git a/crates/languages/src/rust.rs b/crates/languages/src/rust.rs index 04a1eba03381069ac9485cec8f9a84e07a1f4bd4..c566d43c2313ebf53688c827956c547caaac0f8f 100644 --- a/crates/languages/src/rust.rs +++ b/crates/languages/src/rust.rs @@ -1029,7 +1029,7 @@ fn test_fragment(variables: &TaskVariables, path: &Path, stem: &str) -> String { // filter out just that module. Some("--lib".to_owned()) } else if stem == "mod" { - maybe!({ Some(path.parent()?.file_name()?.to_string_lossy().to_string()) }) + maybe!({ Some(path.parent()?.file_name()?.to_string_lossy().into_owned()) }) } else if stem == "main" { if let (Some(bin_name), Some(bin_kind)) = ( variables.get(&RUST_BIN_NAME_TASK_VARIABLE), diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs index 15d6132d972b787f4d12ead244586a52b2ef96b2..344957cd97744e221adf4358bb9680b76fc083da 100644 --- a/crates/multi_buffer/src/multi_buffer.rs +++ b/crates/multi_buffer/src/multi_buffer.rs @@ -178,7 +178,7 @@ impl PathKey { pub fn for_buffer(buffer: &Entity, cx: &App) -> Self { if let Some(file) = buffer.read(cx).file() { - Self::namespaced(1, file.full_path(cx).to_string_lossy().to_string().into()) + Self::namespaced(1, file.full_path(cx).to_string_lossy().into_owned().into()) } else { Self::namespaced(0, buffer.entity_id().to_string().into()) } diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index a2c404af805db03076c112792445a04833cbbf1d..1217d72ccb2fd3a50282b8718f2d2380ef995b7d 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -1893,7 +1893,7 @@ impl OutlinePanel { if let Some(clipboard_text) = self .selected_entry() .and_then(|entry| self.abs_path(entry, cx)) - .map(|p| p.to_string_lossy().to_string()) + .map(|p| p.to_string_lossy().into_owned()) { cx.write_to_clipboard(ClipboardItem::new_string(clipboard_text)); } @@ -4077,7 +4077,7 @@ impl OutlinePanel { .iter() .map(|entry| self.entry_name(&worktree_id, entry, cx)) .collect::(); - dir_names_segment.to_string_lossy().to_string() + dir_names_segment.to_string_lossy().into_owned() } fn query(&self, cx: &App) -> Option { diff --git a/crates/project/src/agent_server_store.rs b/crates/project/src/agent_server_store.rs index c11a142b57634e0bc6d4cca66c893cc19d599193..58fb7c5ac8970c4094a6d5f22a077bb4a93265a7 100644 --- a/crates/project/src/agent_server_store.rs +++ b/crates/project/src/agent_server_store.rs @@ -415,7 +415,7 @@ impl AgentServerStore { })?? .await?; Ok(proto::AgentServerCommand { - path: command.path.to_string_lossy().to_string(), + path: command.path.to_string_lossy().into_owned(), args: command.args, env: command .env @@ -650,7 +650,7 @@ fn get_or_npm_install_builtin_agent( anyhow::Ok(AgentServerCommand { path: node_path, - args: vec![agent_server_path.to_string_lossy().to_string()], + args: vec![agent_server_path.to_string_lossy().into_owned()], env: None, }) }) @@ -842,7 +842,7 @@ impl ExternalAgentServer for LocalGemini { // Gemini CLI doesn't seem to have a dedicated invocation for logging in--we just run it normally without any arguments. let login = task::SpawnInTerminal { - command: Some(command.path.to_string_lossy().to_string()), + command: Some(command.path.to_string_lossy().into_owned()), args: command.args.clone(), env: command.env.clone().unwrap_or_default(), label: "gemini /auth".into(), @@ -851,7 +851,11 @@ impl ExternalAgentServer for LocalGemini { command.env.get_or_insert_default().extend(extra_env); command.args.push("--experimental-acp".into()); - Ok((command, root_dir.to_string_lossy().to_string(), Some(login))) + Ok(( + command, + root_dir.to_string_lossy().into_owned(), + Some(login), + )) }) } @@ -919,7 +923,7 @@ impl ExternalAgentServer for LocalClaudeCode { path.strip_suffix("/@zed-industries/claude-code-acp/dist/index.js") }) .map(|path_prefix| task::SpawnInTerminal { - command: Some(command.path.to_string_lossy().to_string()), + command: Some(command.path.to_string_lossy().into_owned()), args: vec![ Path::new(path_prefix) .join("@anthropic-ai/claude-code/cli.js") @@ -935,7 +939,7 @@ impl ExternalAgentServer for LocalClaudeCode { }; command.env.get_or_insert_default().extend(extra_env); - Ok((command, root_dir.to_string_lossy().to_string(), login)) + Ok((command, root_dir.to_string_lossy().into_owned(), login)) }) } @@ -974,7 +978,7 @@ impl ExternalAgentServer for LocalCustomAgent { env.extend(command.env.unwrap_or_default()); env.extend(extra_env); command.env = Some(env); - Ok((command, root_dir.to_string_lossy().to_string(), None)) + Ok((command, root_dir.to_string_lossy().into_owned(), None)) }) } diff --git a/crates/project/src/debugger/session.rs b/crates/project/src/debugger/session.rs index 81cb3ade2e18b6430c4b644495529c4567344da5..c0d08ed5c28755074d5dd54a3c08ec856a4e1e05 100644 --- a/crates/project/src/debugger/session.rs +++ b/crates/project/src/debugger/session.rs @@ -170,8 +170,8 @@ fn client_source(abs_path: &Path) -> dap::Source { dap::Source { name: abs_path .file_name() - .map(|filename| filename.to_string_lossy().to_string()), - path: Some(abs_path.to_string_lossy().to_string()), + .map(|filename| filename.to_string_lossy().into_owned()), + path: Some(abs_path.to_string_lossy().into_owned()), source_reference: None, presentation_hint: None, origin: None, diff --git a/crates/project/src/git_store.rs b/crates/project/src/git_store.rs index cb1887d01b03cb4ef2b10ce206ba2a547639e747..d06fc37288a4a98087e39521016552e0e850be1b 100644 --- a/crates/project/src/git_store.rs +++ b/crates/project/src/git_store.rs @@ -1420,7 +1420,7 @@ impl GitStore { client .request(proto::GitInit { project_id: project_id, - abs_path: path.to_string_lossy().to_string(), + abs_path: path.to_string_lossy().into_owned(), fallback_branch_name, }) .await?; @@ -1455,7 +1455,7 @@ impl GitStore { } let request = upstream_client.request(proto::GitClone { project_id: *upstream_project_id, - abs_path: path.to_string_lossy().to_string(), + abs_path: path.to_string_lossy().into_owned(), remote_repo: repo, }); @@ -2802,7 +2802,7 @@ impl RepositorySnapshot { merge_message: self.merge.message.as_ref().map(|msg| msg.to_string()), project_id, id: self.id.to_proto(), - abs_path: self.work_directory_abs_path.to_string_lossy().to_string(), + abs_path: self.work_directory_abs_path.to_string_lossy().into_owned(), entry_ids: vec![self.id.to_proto()], scan_id: self.scan_id, is_last_update: true, @@ -2871,7 +2871,7 @@ impl RepositorySnapshot { merge_message: self.merge.message.as_ref().map(|msg| msg.to_string()), project_id, id: self.id.to_proto(), - abs_path: self.work_directory_abs_path.to_string_lossy().to_string(), + abs_path: self.work_directory_abs_path.to_string_lossy().into_owned(), entry_ids: vec![], scan_id: self.scan_id, is_last_update: true, diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index f39553e1114768ea7e7f5347690f6749c528f69a..bd65f04c2f846808307d3cb142b1899d2e9f37ea 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -2485,7 +2485,7 @@ impl LocalLspStore { name: None, message: proto::update_language_server::Variant::RegisteredForBuffer( proto::RegisteredForBuffer { - buffer_abs_path: abs_path.to_string_lossy().to_string(), + buffer_abs_path: abs_path.to_string_lossy().into_owned(), buffer_id: buffer_id.to_proto(), }, ), @@ -3188,7 +3188,7 @@ impl LocalLspStore { let pattern = watcher_path .as_path() .strip_prefix(&path) - .map(|p| p.to_string_lossy().to_string()) + .map(|p| p.to_string_lossy().into_owned()) .unwrap_or_else(|e| { debug_panic!( "Failed to strip prefix for string pattern: {}, with prefix: {}, with error: {}", @@ -3196,7 +3196,7 @@ impl LocalLspStore { path.display(), e ); - watcher_path.as_path().to_string_lossy().to_string() + watcher_path.as_path().to_string_lossy().into_owned() }); (path, pattern) } @@ -3212,7 +3212,7 @@ impl LocalLspStore { let path = glob_literal_prefix(Path::new(&rp.pattern)); let pattern = Path::new(&rp.pattern) .strip_prefix(&path) - .map(|p| p.to_string_lossy().to_string()) + .map(|p| p.to_string_lossy().into_owned()) .unwrap_or_else(|e| { debug_panic!( "Failed to strip prefix for relative pattern: {}, with prefix: {}, with error: {}", @@ -3285,7 +3285,7 @@ impl LocalLspStore { Some(( worktree.clone(), RelPath::new(&literal_prefix, path_style).ok()?.into_arc(), - relative.to_string_lossy().to_string(), + relative.to_string_lossy().into_owned(), )) } lsp::GlobPattern::Relative(rp) => { @@ -4622,7 +4622,9 @@ impl LspStore { message: proto::update_language_server::Variant::RegisteredForBuffer( proto::RegisteredForBuffer { - buffer_abs_path: abs_path.to_string_lossy().to_string(), + buffer_abs_path: abs_path + .to_string_lossy() + .into_owned(), buffer_id: buffer_id.to_proto(), }, ), @@ -10582,7 +10584,7 @@ impl LspStore { name: Some(adapter.name()), message: proto::update_language_server::Variant::RegisteredForBuffer( proto::RegisteredForBuffer { - buffer_abs_path: abs_path.to_string_lossy().to_string(), + buffer_abs_path: abs_path.to_string_lossy().into_owned(), buffer_id: buffer_id.to_proto(), }, ), @@ -10843,7 +10845,7 @@ impl LspStore { abs_path, signature, } => { - result.path = abs_path.to_string_lossy().to_string(); + result.path = abs_path.to_string_lossy().into_owned(); result.signature = signature.to_vec(); } } diff --git a/crates/project/src/lsp_store/lsp_ext_command.rs b/crates/project/src/lsp_store/lsp_ext_command.rs index 0263946b25ed58969a3a7a98a9f537ce81d86ab1..c79e3df178290fa614e08a8abd85a527a696b003 100644 --- a/crates/project/src/lsp_store/lsp_ext_command.rs +++ b/crates/project/src/lsp_store/lsp_ext_command.rs @@ -691,7 +691,7 @@ impl LspCommand for GetLspRunnables { task_template.command = shell.program; task_template.args = shell.args; task_template.env = shell.environment; - task_template.cwd = Some(shell.cwd.to_string_lossy().to_string()); + task_template.cwd = Some(shell.cwd.to_string_lossy().into_owned()); } } diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 24a364012e7eac22e34ef767d89b916338379198..06d698abdca0a67fe2a38a71f7599ef1efe6b39f 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -891,8 +891,8 @@ impl DirectoryLister { project .visible_worktrees(cx) .next() - .map(|worktree| worktree.read(cx).abs_path().to_string_lossy().to_string()) - .or_else(|| std::env::home_dir().map(|dir| dir.to_string_lossy().to_string())) + .map(|worktree| worktree.read(cx).abs_path().to_string_lossy().into_owned()) + .or_else(|| std::env::home_dir().map(|dir| dir.to_string_lossy().into_owned())) .map(|mut s| { s.push_str(path_style.separator()); s @@ -4207,7 +4207,7 @@ impl Project { let metadata = fs.metadata(&expanded).await.ok().flatten(); metadata.map(|metadata| ResolvedPath::AbsPath { - path: expanded.to_string_lossy().to_string(), + path: expanded.to_string_lossy().into_owned(), is_dir: metadata.is_dir, }) }) diff --git a/crates/project/src/task_inventory.rs b/crates/project/src/task_inventory.rs index 186cdcafc638d76770873649cb109305e073cb27..4f4939491f19ebe6d32b82f780c4a9988a66c1d4 100644 --- a/crates/project/src/task_inventory.rs +++ b/crates/project/src/task_inventory.rs @@ -1027,7 +1027,7 @@ impl ContextProvider for BasicContextProvider { let path_style = worktree.path_style(); task_variables.insert( VariableName::WorktreeRoot, - worktree.abs_path().to_string_lossy().to_string(), + worktree.abs_path().to_string_lossy().into_owned(), ); if let Some(current_file) = current_file.as_ref() { let relative_path = current_file.path(); @@ -1062,7 +1062,7 @@ impl ContextProvider for BasicContextProvider { task_variables.insert(VariableName::Dirname, dirname.into()); } - task_variables.insert(VariableName::File, path.to_string_lossy().to_string()); + task_variables.insert(VariableName::File, path.to_string_lossy().into_owned()); } Task::ready(Ok(task_variables)) diff --git a/crates/project/src/task_store.rs b/crates/project/src/task_store.rs index 89cc2fc4842549b11cb30b4614553d0b27fcc63d..0de5e239798c6a95078d79c2a25775c914a13611 100644 --- a/crates/project/src/task_store.rs +++ b/crates/project/src/task_store.rs @@ -149,7 +149,7 @@ impl TaskStore { project_env: task_context.project_env.into_iter().collect(), cwd: task_context .cwd - .map(|cwd| cwd.to_string_lossy().to_string()), + .map(|cwd| cwd.to_string_lossy().into_owned()), task_variables: task_context .task_variables .into_iter() diff --git a/crates/project/src/toolchain_store.rs b/crates/project/src/toolchain_store.rs index 8d78f751848d12e9300bee7e8b5341cdc23f47bb..2b967ef2304af197e5a95cdeb661d746dbc7e6f1 100644 --- a/crates/project/src/toolchain_store.rs +++ b/crates/project/src/toolchain_store.rs @@ -278,7 +278,7 @@ impl ToolchainStore { let path = PathBuf::from(toolchain.path.to_string()); proto::Toolchain { name: toolchain.name.into(), - path: path.to_string_lossy().to_string(), + path: path.to_string_lossy().into_owned(), raw_json: toolchain.as_json.to_string(), } }), @@ -330,7 +330,7 @@ impl ToolchainStore { let path = PathBuf::from(toolchain.path.to_string()); proto::Toolchain { name: toolchain.name.to_string(), - path: path.to_string_lossy().to_string(), + path: path.to_string_lossy().into_owned(), raw_json: toolchain.as_json.to_string(), } }) @@ -609,7 +609,7 @@ impl RemoteToolchainStore { language_name: toolchain.language_name.into(), toolchain: Some(proto::Toolchain { name: toolchain.name.into(), - path: path.to_string_lossy().to_string(), + path: path.to_string_lossy().into_owned(), raw_json: toolchain.as_json.to_string(), }), path: Some(project_path.path.to_proto()), diff --git a/crates/project/src/worktree_store.rs b/crates/project/src/worktree_store.rs index 068249e85ae83253071e416f46a1acd65b051573..37bad3387a3c101f67eb721dded477ba538ae933 100644 --- a/crates/project/src/worktree_store.rs +++ b/crates/project/src/worktree_store.rs @@ -536,8 +536,8 @@ impl WorktreeStore { let root_path_buf = PathBuf::from(response.canonicalized_path.clone()); let root_name = root_path_buf .file_name() - .map(|n| n.to_string_lossy().to_string()) - .unwrap_or(root_path_buf.to_string_lossy().to_string()); + .map(|n| n.to_string_lossy().into_owned()) + .unwrap_or(root_path_buf.to_string_lossy().into_owned()); let worktree = cx.update(|cx| { Worktree::remote( @@ -860,7 +860,7 @@ impl WorktreeStore { id: worktree.id().to_proto(), root_name: worktree.root_name_str().to_owned(), visible: worktree.is_visible(), - abs_path: worktree.abs_path().to_string_lossy().to_string(), + abs_path: worktree.abs_path().to_string_lossy().into_owned(), } }) .collect() diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index 5aaefeb42112de5ffbb0f115fcf7019612e94e33..7017fec7865dcc98fde295ee5838c1e81c6b511d 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -4081,7 +4081,7 @@ impl ProjectPanel { let canonical_path = details .canonical_path .as_ref() - .map(|f| f.to_string_lossy().to_string()); + .map(|f| f.to_string_lossy().into_owned()); let path_style = self.project.read(cx).path_style(cx); let path = details.path.clone(); let path_for_external_paths = path.clone(); diff --git a/crates/recent_projects/src/recent_projects.rs b/crates/recent_projects/src/recent_projects.rs index ad7270d98c2597d77a71945c4aed97374cc6d8da..2b3292288ae866036db70e2b832af9fc06d443e0 100644 --- a/crates/recent_projects/src/recent_projects.rs +++ b/crates/recent_projects/src/recent_projects.rs @@ -604,7 +604,7 @@ fn highlights_for_path( // Again subset the highlight positions to just those that line up with the file_name // again adjusted to the start of the file_name let file_name_text_and_positions = path.file_name().map(|file_name| { - let file_name_text = file_name.to_string_lossy().to_string(); + let file_name_text = file_name.to_string_lossy().into_owned(); let file_name_start_byte = path_byte_len - file_name_text.len(); let highlight_positions = path_positions .iter() diff --git a/crates/recent_projects/src/remote_connections.rs b/crates/recent_projects/src/remote_connections.rs index 689b06da71e43cfa451113a87b2db46be3bcaa75..2e0358d0fcbf0e655698761894345499b9587942 100644 --- a/crates/recent_projects/src/remote_connections.rs +++ b/crates/recent_projects/src/remote_connections.rs @@ -369,7 +369,7 @@ impl RenderOnce for SshConnectionHeader { ) .child(div().overflow_x_hidden().text_ellipsis().children( self.paths.into_iter().map(|path| { - Label::new(path.to_string_lossy().to_string()) + Label::new(path.to_string_lossy().into_owned()) .size(LabelSize::Small) .color(Color::Muted) }), diff --git a/crates/recent_projects/src/remote_servers.rs b/crates/recent_projects/src/remote_servers.rs index 989a054fcad948c3acdea2ffcd462eee9bf2fcc6..cf03d226986c2a8e79f630eff430baf9206985ce 100644 --- a/crates/recent_projects/src/remote_servers.rs +++ b/crates/recent_projects/src/remote_servers.rs @@ -238,7 +238,7 @@ impl ProjectPicker { update_settings_file(fs, cx, { let paths = paths .iter() - .map(|path| path.to_string_lossy().to_string()) + .map(|path| path.to_string_lossy().into_owned()) .collect(); move |settings, _| match index { ServerIndex::Ssh(index) => { diff --git a/crates/remote_server/src/headless_project.rs b/crates/remote_server/src/headless_project.rs index 0309ae36b1a985cbcc4e8b02332d209f27844d52..96b33cdca3a39f24c1d06b7cb33fe97776cd942f 100644 --- a/crates/remote_server/src/headless_project.rs +++ b/crates/remote_server/src/headless_project.rs @@ -442,7 +442,7 @@ impl HeadlessProject { let worktree = worktree.read(cx); proto::AddWorktreeResponse { worktree_id: worktree.id().to_proto(), - canonicalized_path: canonicalized.to_string_lossy().to_string(), + canonicalized_path: canonicalized.to_string_lossy().into_owned(), } })?; @@ -672,7 +672,7 @@ impl HeadlessProject { while let Some(path) = response.next().await { let path = path?; if let Some(file_name) = path.file_name() { - entries.push(file_name.to_string_lossy().to_string()); + entries.push(file_name.to_string_lossy().into_owned()); if check_info { let is_dir = fs.is_dir(&path).await; entry_info.push(proto::EntryInfo { is_dir }); @@ -699,7 +699,7 @@ impl HeadlessProject { Ok(proto::GetPathMetadataResponse { exists: metadata.is_some(), is_dir, - path: expanded.to_string_lossy().to_string(), + path: expanded.to_string_lossy().into_owned(), }) } @@ -743,7 +743,7 @@ impl HeadlessProject { let command = process .cmd() .iter() - .map(|s| s.to_string_lossy().to_string()) + .map(|s| s.to_string_lossy().into_owned()) .collect::>(); processes.push(proto::ProcessInfo { diff --git a/crates/repl/src/kernels/mod.rs b/crates/repl/src/kernels/mod.rs index f8407f40f3fab98d0a9f80cb2ee8cf008a7e856f..a99c80230a4ec468ac6505346b4c0d017e7576d7 100644 --- a/crates/repl/src/kernels/mod.rs +++ b/crates/repl/src/kernels/mod.rs @@ -48,8 +48,8 @@ impl KernelSpecification { pub fn path(&self) -> SharedString { SharedString::from(match self { - Self::Jupyter(spec) => spec.path.to_string_lossy().to_string(), - Self::PythonEnv(spec) => spec.path.to_string_lossy().to_string(), + Self::Jupyter(spec) => spec.path.to_string_lossy().into_owned(), + Self::PythonEnv(spec) => spec.path.to_string_lossy().into_owned(), Self::Remote(spec) => spec.url.to_string(), }) } diff --git a/crates/repl/src/kernels/native_kernel.rs b/crates/repl/src/kernels/native_kernel.rs index 83271fae16fd2d22f37fd03d86dae277070e20eb..cf88fbc582296e1d61ea729a642a7e8ec8e290df 100644 --- a/crates/repl/src/kernels/native_kernel.rs +++ b/crates/repl/src/kernels/native_kernel.rs @@ -371,7 +371,7 @@ async fn read_kernelspec_at( ) -> Result { let path = kernel_dir; let kernel_name = if let Some(kernel_name) = path.file_name() { - kernel_name.to_string_lossy().to_string() + kernel_name.to_string_lossy().into_owned() } else { anyhow::bail!("Invalid kernelspec directory: {path:?}"); }; diff --git a/crates/settings/src/vscode_import.rs b/crates/settings/src/vscode_import.rs index 85e9cfacf290dcbe4b63768e990a44203f9aa2a9..e6e64093a7fd255a582e86c47c7617f695e7b94f 100644 --- a/crates/settings/src/vscode_import.rs +++ b/crates/settings/src/vscode_import.rs @@ -51,7 +51,7 @@ impl VsCodeSettings { "No settings file found, expected to find it in one of the following paths:\n{}", candidate_paths .into_iter() - .map(|path| path.to_string_lossy().to_string()) + .map(|path| path.to_string_lossy().into_owned()) .collect::>() .join("\n") )); diff --git a/crates/tasks_ui/src/tasks_ui.rs b/crates/tasks_ui/src/tasks_ui.rs index 0b6912c0a94cdb8aa72dd72fa45ac9b8976e4ad6..ce925cdd7e2f60497fb9e6d37c44332958875530 100644 --- a/crates/tasks_ui/src/tasks_ui.rs +++ b/crates/tasks_ui/src/tasks_ui.rs @@ -379,7 +379,7 @@ fn worktree_context(worktree_abs_path: &Path) -> TaskContext { let mut task_variables = TaskVariables::default(); task_variables.insert( VariableName::WorktreeRoot, - worktree_abs_path.to_string_lossy().to_string(), + worktree_abs_path.to_string_lossy().into_owned(), ); TaskContext { cwd: Some(worktree_abs_path.to_path_buf()), diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 827a3dc9b8e2a8ac67c93e7cc70e95a2f3fe8e77..646806ede1ae3320b5551e4b724d9b9cedd09990 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -1862,7 +1862,7 @@ impl Terminal { let process_file = fpi .cwd .file_name() - .map(|name| name.to_string_lossy().to_string()) + .map(|name| name.to_string_lossy().into_owned()) .unwrap_or_default(); let argv = fpi.argv.as_slice(); diff --git a/crates/terminal/src/terminal_hyperlinks.rs b/crates/terminal/src/terminal_hyperlinks.rs index 3c20261988a7b30e124000bcdae7596c162d0853..d3b50674204884e168d8cee39110a5b05ce13f54 100644 --- a/crates/terminal/src/terminal_hyperlinks.rs +++ b/crates/terminal/src/terminal_hyperlinks.rs @@ -1127,7 +1127,7 @@ mod tests { let Ok(path) = url.to_file_path() else { panic!("Failed to interpret file IRI `{iri_or_path}` as a path"); }; - iri_or_path = path.to_string_lossy().to_string(); + iri_or_path = path.to_string_lossy().into_owned(); } if cfg!(windows) { diff --git a/crates/terminal_view/src/persistence.rs b/crates/terminal_view/src/persistence.rs index 9759fe8337bc4a870fb6fe0a903edf5c542f5d4f..14606d4ed58054cca70ca16d420e90083bcbcc14 100644 --- a/crates/terminal_view/src/persistence.rs +++ b/crates/terminal_view/src/persistence.rs @@ -458,7 +458,10 @@ impl TerminalDb { let mut next_index = statement.bind(&item_id, 1)?; next_index = statement.bind(&workspace_id, next_index)?; next_index = statement.bind(&working_directory, next_index)?; - statement.bind(&working_directory.to_string_lossy().to_string(), next_index)?; + statement.bind( + &working_directory.to_string_lossy().into_owned(), + next_index, + )?; statement.exec() }) .await diff --git a/crates/terminal_view/src/terminal_path_like_target.rs b/crates/terminal_view/src/terminal_path_like_target.rs index 4469a975ad62fbfbe32f3e6c2f4d56d704097428..8a9b824286508f26c824b18c6ba9a0dbc16e90bd 100644 --- a/crates/terminal_view/src/terminal_path_like_target.rs +++ b/crates/terminal_view/src/terminal_path_like_target.rs @@ -109,7 +109,7 @@ fn possible_hover_target( .update(cx, |terminal_view, _| match file_to_open { Some(OpenTarget::File(path, _) | OpenTarget::Worktree(path, ..)) => { terminal_view.hover = Some(HoverTarget { - tooltip: path.to_string(|path| path.to_string_lossy().to_string()), + tooltip: path.to_string(|path| path.to_string_lossy().into_owned()), hovered_word, }); } diff --git a/crates/util/src/paths.rs b/crates/util/src/paths.rs index 085b8b74cb67baf6082fd648a80cb12da9c561ee..c2742036b8449d02ecd1b21f69fda46bdb9756eb 100644 --- a/crates/util/src/paths.rs +++ b/crates/util/src/paths.rs @@ -1233,7 +1233,7 @@ mod tests { #[perf] fn test_path_compact() { let path: PathBuf = [ - home_dir().to_string_lossy().to_string(), + home_dir().to_string_lossy().into_owned(), "some_file.txt".to_string(), ] .iter() diff --git a/crates/util/src/util.rs b/crates/util/src/util.rs index 055e45c3049d4bdf698805291f6c06972a6359bc..d67aa67f63917f6da42248b98be7a6171ef66892 100644 --- a/crates/util/src/util.rs +++ b/crates/util/src/util.rs @@ -599,7 +599,7 @@ pub fn get_windows_system_shell() -> String { .or_else(|| find_pwsh_in_msix(true)) .or_else(|| find_pwsh_in_programfiles(true, true)) .or_else(find_pwsh_in_scoop) - .map(|p| p.to_string_lossy().to_string()) + .map(|p| p.to_string_lossy().into_owned()) .unwrap_or("powershell.exe".to_string()) }); diff --git a/crates/vim/src/normal.rs b/crates/vim/src/normal.rs index 257d60290932630db3c6504bf28d3988cd843f4a..a0f672bdf82cdc8fbe5c21c01165833fb6200113 100644 --- a/crates/vim/src/normal.rs +++ b/crates/vim/src/normal.rs @@ -858,9 +858,9 @@ impl Vim { let filename = if let Some(file) = buffer.read(cx).file() { if count.is_some() { if let Some(local) = file.as_local() { - local.abs_path(cx).to_string_lossy().to_string() + local.abs_path(cx).to_string_lossy().into_owned() } else { - file.full_path(cx).to_string_lossy().to_string() + file.full_path(cx).to_string_lossy().into_owned() } } else { file.path().display(file.path_style(cx)).into_owned() diff --git a/crates/vim/src/state.rs b/crates/vim/src/state.rs index 80f96523ab3a2f30a470832059d24c5b58117ac4..490f1dc7452dd37364d83b9b8321c33e9309a275 100644 --- a/crates/vim/src/state.rs +++ b/crates/vim/src/state.rs @@ -1610,7 +1610,7 @@ impl PickerDelegate for MarksViewDelegate { let (right_output, right_runs): (String, Vec<_>) = match &mark_match.info { MarksMatchInfo::Path(path) => { - let s = path.to_string_lossy().to_string(); + let s = path.to_string_lossy().into_owned(); ( s.clone(), vec![(0..s.len(), HighlightStyle::color(cx.theme().colors().text))], diff --git a/crates/workspace/src/pane.rs b/crates/workspace/src/pane.rs index d069f245053f887f34ec42a355ff2ceda4046de8..726488a2dda52b63f294d16d0434709d1ab4c985 100644 --- a/crates/workspace/src/pane.rs +++ b/crates/workspace/src/pane.rs @@ -2865,7 +2865,7 @@ impl Pane { Some(Box::new(zed_actions::workspace::CopyPath)), window.handler_for(&pane, move |_, _, cx| { cx.write_to_clipboard(ClipboardItem::new_string( - abs_path.to_string_lossy().to_string(), + abs_path.to_string_lossy().into_owned(), )); }), ) diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 5accfba47216d745f95f2cc08f6373f328a89545..eae6986c0084c23bd1581cc1605ca714d877bbf1 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -622,7 +622,7 @@ impl Worktree { id: self.id().to_proto(), root_name: self.root_name().to_proto(), visible: self.is_visible(), - abs_path: self.abs_path().to_string_lossy().to_string(), + abs_path: self.abs_path().to_string_lossy().into_owned(), } } @@ -982,7 +982,7 @@ impl Worktree { .join("~", &*stripped.to_string_lossy()) .unwrap() } else { - full_path.to_string_lossy().to_string() + full_path.to_string_lossy().into_owned() }; if worktree_relative_path.components().next().is_some() { @@ -2072,7 +2072,7 @@ impl Snapshot { proto::UpdateWorktree { project_id, worktree_id, - abs_path: self.abs_path().to_string_lossy().to_string(), + abs_path: self.abs_path().to_string_lossy().into_owned(), root_name: self.root_name().to_proto(), updated_entries, removed_entries: Vec::new(), @@ -2415,7 +2415,7 @@ impl LocalSnapshot { proto::UpdateWorktree { project_id, worktree_id, - abs_path: self.abs_path().to_string_lossy().to_string(), + abs_path: self.abs_path().to_string_lossy().into_owned(), root_name: self.root_name().to_proto(), updated_entries, removed_entries, @@ -5354,7 +5354,7 @@ impl<'a> From<&'a Entry> for proto::Entry { canonical_path: entry .canonical_path .as_ref() - .map(|path| path.to_string_lossy().to_string()), + .map(|path| path.to_string_lossy().into_owned()), } } } diff --git a/crates/zed/src/zed/open_listener.rs b/crates/zed/src/zed/open_listener.rs index 16bd0a1e7f9bf3837779b597729704e9580bc42d..a8a998b6580269de150280c432c329cf59c30c22 100644 --- a/crates/zed/src/zed/open_listener.rs +++ b/crates/zed/src/zed/open_listener.rs @@ -434,7 +434,7 @@ async fn open_workspaces( let workspace_paths = workspace_paths .paths() .iter() - .map(|path| path.to_string_lossy().to_string()) + .map(|path| path.to_string_lossy().into_owned()) .collect(); let workspace_failed_to_open = open_local_workspace( diff --git a/crates/zed/src/zed/windows_only_instance.rs b/crates/zed/src/zed/windows_only_instance.rs index d377f06ede778b47dbac3257069d2b1c647935ae..45f3cd158bb38156a0981f01e5331dc0aead91c9 100644 --- a/crates/zed/src/zed/windows_only_instance.rs +++ b/crates/zed/src/zed/windows_only_instance.rs @@ -104,7 +104,7 @@ fn retrieve_message_from_pipe_inner(pipe: HANDLE) -> anyhow::Result { ReadFile(pipe, Some(&mut buffer), None, None)?; } let message = std::ffi::CStr::from_bytes_until_nul(&buffer)?; - Ok(message.to_string_lossy().to_string()) + Ok(message.to_string_lossy().into_owned()) } // This part of code is mostly from crates/cli/src/main.rs @@ -124,7 +124,7 @@ fn send_args_to_instance(args: &Args) -> anyhow::Result<()> { let mut diff_paths = vec![]; for path in args.paths_or_urls.iter() { match std::fs::canonicalize(&path) { - Ok(path) => paths.push(path.to_string_lossy().to_string()), + Ok(path) => paths.push(path.to_string_lossy().into_owned()), Err(error) => { if path.starts_with("zed://") || path.starts_with("http://") @@ -145,8 +145,8 @@ fn send_args_to_instance(args: &Args) -> anyhow::Result<()> { let new = std::fs::canonicalize(&path[1]).log_err(); if let Some((old, new)) = old.zip(new) { diff_paths.push([ - old.to_string_lossy().to_string(), - new.to_string_lossy().to_string(), + old.to_string_lossy().into_owned(), + new.to_string_lossy().into_owned(), ]); } } diff --git a/crates/zeta/src/license_detection.rs b/crates/zeta/src/license_detection.rs index 3c9e97189dadfa4bcaa17b12e8c792edde352579..44dae09d0a18e5732b9c52ce73cdf71abecc81b0 100644 --- a/crates/zeta/src/license_detection.rs +++ b/crates/zeta/src/license_detection.rs @@ -435,7 +435,7 @@ mod tests { let Ok(contents) = std::fs::read_to_string(entry.path()) else { continue; }; - let path_string = entry.path().to_string_lossy().to_string(); + let path_string = entry.path().to_string_lossy().into_owned(); let license = detect_license(&contents); match license { Some(license) => detected.push((license, path_string)), diff --git a/crates/zeta/src/rate_completion_modal.rs b/crates/zeta/src/rate_completion_modal.rs index f572a0a1aa797a8afda72d9c86ad82c850cc6d9b..8028865b057f0c6c3b49efc3a5c3c640208e65aa 100644 --- a/crates/zeta/src/rate_completion_modal.rs +++ b/crates/zeta/src/rate_completion_modal.rs @@ -619,8 +619,8 @@ impl Render for RateCompletionModal { (false, false) => (IconName::FileDiff, Color::Accent, "Edits Available"), }; - let file_name = completion.path.file_name().map(|f| f.to_string_lossy().to_string()).unwrap_or("untitled".to_string()); - let file_path = completion.path.parent().map(|p| p.to_string_lossy().to_string()); + let file_name = completion.path.file_name().map(|f| f.to_string_lossy().into_owned()).unwrap_or("untitled".to_string()); + let file_path = completion.path.parent().map(|p| p.to_string_lossy().into_owned()); ListItem::new(completion.id) .inset(true) diff --git a/crates/zeta/src/zeta.rs b/crates/zeta/src/zeta.rs index 6e546465322453c5f4e8f474a21eb2738dc3a5ff..6a75b5e2cd369002d928992e61124c18cc47c5e7 100644 --- a/crates/zeta/src/zeta.rs +++ b/crates/zeta/src/zeta.rs @@ -443,7 +443,7 @@ impl Zeta { .file() .map(|f| Arc::from(f.full_path(cx).as_path())) .unwrap_or_else(|| Arc::from(Path::new("untitled"))); - let full_path_str = full_path.to_string_lossy().to_string(); + let full_path_str = full_path.to_string_lossy().into_owned(); let cursor_point = cursor.to_point(&snapshot); let cursor_offset = cursor_point.to_offset(&snapshot); let prompt_for_events = {