diff --git a/crates/agent/src/context_picker.rs b/crates/agent/src/context_picker.rs index cd7288c311..3f29e12f3b 100644 --- a/crates/agent/src/context_picker.rs +++ b/crates/agent/src/context_picker.rs @@ -942,8 +942,8 @@ impl MentionLink { format!("[@{}]({}:{})", title, Self::THREAD, id) } ThreadContextEntry::Context { path, title } => { - let filename = path.file_name().unwrap_or_default(); - let escaped_filename = urlencoding::encode(&filename.to_string_lossy()).to_string(); + let filename = path.file_name().unwrap_or_default().to_string_lossy(); + let escaped_filename = urlencoding::encode(&filename); format!( "[@{}]({}:{}{})", title, diff --git a/crates/agent/src/terminal_inline_assistant.rs b/crates/agent/src/terminal_inline_assistant.rs index 64e23fba14..992f32af98 100644 --- a/crates/agent/src/terminal_inline_assistant.rs +++ b/crates/agent/src/terminal_inline_assistant.rs @@ -191,7 +191,7 @@ impl TerminalInlineAssistant { }; self.prompt_history.retain(|prompt| *prompt != user_prompt); - self.prompt_history.push_back(user_prompt.clone()); + self.prompt_history.push_back(user_prompt); if self.prompt_history.len() > PROMPT_HISTORY_MAX_LEN { self.prompt_history.pop_front(); } diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index 5790be6644..98c67804ab 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -2583,7 +2583,7 @@ impl Thread { .read(cx) .current_user() .map(|user| user.github_login.clone()); - let client = self.project.read(cx).client().clone(); + let client = self.project.read(cx).client(); let serialize_task = self.serialize(cx); cx.background_executor() diff --git a/crates/agent/src/thread_history.rs b/crates/agent/src/thread_history.rs index 353291f4e3..4342722937 100644 --- a/crates/agent/src/thread_history.rs +++ b/crates/agent/src/thread_history.rs @@ -260,10 +260,7 @@ impl ThreadHistory { } }); - self.search_state = SearchState::Searching { - query: query.clone(), - _task: task, - }; + self.search_state = SearchState::Searching { query, _task: task }; cx.notify(); } diff --git a/crates/assistant_context_editor/src/context_editor.rs b/crates/assistant_context_editor/src/context_editor.rs index 42ca88e2f2..53d446dc25 100644 --- a/crates/assistant_context_editor/src/context_editor.rs +++ b/crates/assistant_context_editor/src/context_editor.rs @@ -3044,7 +3044,7 @@ fn invoked_slash_command_fold_placeholder( .gap_2() .bg(cx.theme().colors().surface_background) .rounded_sm() - .child(Label::new(format!("/{}", command.name.clone()))) + .child(Label::new(format!("/{}", command.name))) .map(|parent| match &command.status { InvokedSlashCommandStatus::Running(_) => { parent.child(Icon::new(IconName::ArrowCircle).with_animation( diff --git a/crates/client/src/telemetry.rs b/crates/client/src/telemetry.rs index fa7690a6a3..500aa528c2 100644 --- a/crates/client/src/telemetry.rs +++ b/crates/client/src/telemetry.rs @@ -137,18 +137,14 @@ pub fn os_version() -> String { log::error!("Failed to load /etc/os-release, /usr/lib/os-release"); "".to_string() }; - let mut name = "unknown".to_string(); - let mut version = "unknown".to_string(); + let mut name = "unknown"; + let mut version = "unknown"; for line in content.lines() { - if line.starts_with("ID=") { - name = line.trim_start_matches("ID=").trim_matches('"').to_string(); - } - if line.starts_with("VERSION_ID=") { - version = line - .trim_start_matches("VERSION_ID=") - .trim_matches('"') - .to_string(); + match line.split_once('=') { + Some(("ID", val)) => name = val.trim_matches('"'), + Some(("VERSION_ID", val)) => version = val.trim_matches('"'), + _ => {} } } @@ -222,7 +218,7 @@ impl Telemetry { cx.background_spawn({ let state = state.clone(); let os_version = os_version(); - state.lock().os_version = Some(os_version.clone()); + state.lock().os_version = Some(os_version); async move { if let Some(tempfile) = File::create(Self::log_file_path()).log_err() { state.lock().log_file = Some(tempfile); diff --git a/crates/collab_ui/src/chat_panel.rs b/crates/collab_ui/src/chat_panel.rs index 0eee89d1fe..55b7ade771 100644 --- a/crates/collab_ui/src/chat_panel.rs +++ b/crates/collab_ui/src/chat_panel.rs @@ -1059,7 +1059,7 @@ impl Render for ChatPanel { .child( Label::new(format!( "@{}", - user_being_replied_to.github_login.clone() + user_being_replied_to.github_login )) .size(LabelSize::Small) .weight(FontWeight::BOLD), diff --git a/crates/debugger_ui/src/session/running/console.rs b/crates/debugger_ui/src/session/running/console.rs index a98adb0fb8..72eae3726c 100644 --- a/crates/debugger_ui/src/session/running/console.rs +++ b/crates/debugger_ui/src/session/running/console.rs @@ -365,7 +365,7 @@ impl ConsoleQueryBarCompletionProvider { new_text: string_match.string.clone(), label: CodeLabel { filter_range: 0..string_match.string.len(), - text: format!("{} {}", string_match.string.clone(), variable_value), + text: format!("{} {}", string_match.string, variable_value), runs: Vec::new(), }, icon_path: None, diff --git a/crates/extensions_ui/src/extensions_ui.rs b/crates/extensions_ui/src/extensions_ui.rs index 15c73effee..0383687304 100644 --- a/crates/extensions_ui/src/extensions_ui.rs +++ b/crates/extensions_ui/src/extensions_ui.rs @@ -955,7 +955,7 @@ impl ExtensionsPage { .disabled(true), configure: is_configurable.then(|| { Button::new( - SharedString::from(format!("configure-{}", extension.id.clone())), + SharedString::from(format!("configure-{}", extension.id)), "Configure", ) .disabled(true) @@ -980,7 +980,7 @@ impl ExtensionsPage { }), configure: is_configurable.then(|| { Button::new( - SharedString::from(format!("configure-{}", extension.id.clone())), + SharedString::from(format!("configure-{}", extension.id)), "Configure", ) .on_click({ @@ -1049,7 +1049,7 @@ impl ExtensionsPage { .disabled(true), configure: is_configurable.then(|| { Button::new( - SharedString::from(format!("configure-{}", extension.id.clone())), + SharedString::from(format!("configure-{}", extension.id)), "Configure", ) .disabled(true) diff --git a/crates/file_finder/src/new_path_prompt.rs b/crates/file_finder/src/new_path_prompt.rs index e4d5ff0618..69b473e146 100644 --- a/crates/file_finder/src/new_path_prompt.rs +++ b/crates/file_finder/src/new_path_prompt.rs @@ -354,8 +354,9 @@ impl PickerDelegate for NewPathDelegate { let m = self.matches.get(self.selected_index)?; if m.is_dir(self.project.read(cx), cx) { let path = m.relative_path(); - self.last_selected_dir = Some(path.clone()); - Some(format!("{}/", path)) + let result = format!("{}/", path); + self.last_selected_dir = Some(path); + Some(result) } else { None } diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 03acd514a1..1d01636823 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -2583,19 +2583,18 @@ impl GitPanel { } else { workspace.update(cx, |workspace, cx| { let workspace_weak = cx.weak_entity(); - let toast = - StatusToast::new(format!("git {} failed", action.clone()), cx, |this, _cx| { - this.icon(ToastIcon::new(IconName::XCircle).color(Color::Error)) - .action("View Log", move |window, cx| { - let message = message.clone(); - let action = action.clone(); - workspace_weak - .update(cx, move |workspace, cx| { - Self::open_output(action, workspace, &message, window, cx) - }) - .ok(); - }) - }); + let toast = StatusToast::new(format!("git {} failed", action), cx, |this, _cx| { + this.icon(ToastIcon::new(IconName::XCircle).color(Color::Error)) + .action("View Log", move |window, cx| { + let message = message.clone(); + let action = action.clone(); + workspace_weak + .update(cx, move |workspace, cx| { + Self::open_output(action, workspace, &message, window, cx) + }) + .ok(); + }) + }); workspace.toggle_status_toast(toast, cx) }); } diff --git a/crates/proto/src/error.rs b/crates/proto/src/error.rs index 680056fc1c..8d9c1015d9 100644 --- a/crates/proto/src/error.rs +++ b/crates/proto/src/error.rs @@ -134,7 +134,7 @@ impl From for anyhow::Error { RpcError { request: None, code: value, - msg: format!("{:?}", value).to_string(), + msg: format!("{:?}", value), tags: Default::default(), } .into() @@ -241,7 +241,7 @@ impl From for RpcError { RpcError { request: None, code, - msg: format!("{:?}", code).to_string(), + msg: format!("{:?}", code), tags: Default::default(), } } diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index 0d49cf3955..f50e945df3 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -1946,9 +1946,9 @@ impl Render for ProjectSearchBar { if match_quantity > 0 { debug_assert!(match_quantity >= index); if limit_reached { - Some(format!("{index}/{match_quantity}+").to_string()) + Some(format!("{index}/{match_quantity}+")) } else { - Some(format!("{index}/{match_quantity}").to_string()) + Some(format!("{index}/{match_quantity}")) } } else { None diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index 56f269b008..507fd4df10 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -269,13 +269,12 @@ impl TerminalError { Err(s) => s, } }) - .unwrap_or_else(|| { - let default_dir = - dirs::home_dir().map(|buf| buf.into_os_string().to_string_lossy().to_string()); - match default_dir { - Some(dir) => format!(" {}", dir), - None => "".to_string(), - } + .unwrap_or_else(|| match dirs::home_dir() { + Some(dir) => format!( + " {}", + dir.into_os_string().to_string_lossy() + ), + None => "".to_string(), }) } diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index bb77e6ac43..c629981541 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -475,7 +475,7 @@ impl TitleBar { .label_size(LabelSize::Small) .tooltip(Tooltip::text(format!( "{} is sharing this project. Click to follow.", - host_user.github_login.clone() + host_user.github_login ))) .on_click({ let host_peer_id = host.peer_id; diff --git a/crates/ui/src/components/modal.rs b/crates/ui/src/components/modal.rs index 7b2c8beb62..2e926b7593 100644 --- a/crates/ui/src/components/modal.rs +++ b/crates/ui/src/components/modal.rs @@ -20,7 +20,7 @@ impl Modal { pub fn new(id: impl Into, scroll_handle: Option) -> Self { let id = id.into(); - let container_id = ElementId::Name(format!("{}_container", id.clone()).into()); + let container_id = ElementId::Name(format!("{}_container", id).into()); Self { id: ElementId::Name(id), header: ModalHeader::new(), diff --git a/crates/zed/src/zed/quick_action_bar/repl_menu.rs b/crates/zed/src/zed/quick_action_bar/repl_menu.rs index a7e00adf0c..12e5cf1b76 100644 --- a/crates/zed/src/zed/quick_action_bar/repl_menu.rs +++ b/crates/zed/src/zed/quick_action_bar/repl_menu.rs @@ -77,7 +77,7 @@ impl QuickActionBar { let menu_state = session_state(session.clone(), cx); - let id = "repl-menu".to_string(); + let id = "repl-menu"; let element_id = |suffix| ElementId::Name(format!("{}-{}", id, suffix).into()); @@ -99,8 +99,7 @@ impl QuickActionBar { .child( Label::new(format!( "kernel: {} ({})", - menu_state.kernel_name.clone(), - menu_state.kernel_language.clone() + menu_state.kernel_name, menu_state.kernel_language )) .size(LabelSize::Small) .color(Color::Muted), @@ -121,7 +120,7 @@ impl QuickActionBar { menu.custom_row(move |_window, _cx| { h_flex() .child( - Label::new(format!("{}...", status.clone().to_string())) + Label::new(format!("{}...", status.to_string())) .size(LabelSize::Small) .color(Color::Muted), )