diff --git a/crates/agent/src/context_picker.rs b/crates/agent/src/context_picker.rs index cd7288c311266c9ed44667f1bf8d3b5a01aa9fd0..3f29e12f3bd92650acfedf7ac11379723bc72ec2 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 64e23fba14c680444a2577f236e94a97d09a0a93..992f32af985ba2cdb670cdbe7c5637d16d37b096 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 5790be664405413352571e29fbfd344f18382746..98c67804ab20039208448a89bcd9cf19e9ba432a 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 353291f4e372ca24597c1b845d55b3a5f123dc94..43427229375ea4cdbc4c379b75b2f6bb61903f4e 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 42ca88e2f20c7f69d876d8567e947c9c8ac2b719..53d446dc2510bab88d7c17caee3944949fceb450 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 fa7690a6a363449f5bfb60dc28cfacd69bb41992..500aa528c298f335526c0ea4bb40ffdc4fa38829 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 0eee89d1fec38ec0f6b81381db4beb208a4b2004..55b7ade771e6f0621f006c250a5e02b743df09d2 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 a98adb0fb8172b4688c0faf1133ab727be090952..72eae3726c4b4c09e41457ea6c269da20b552523 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 15c73effeeb56f49f11b8c7e9ffd131e613839b4..03836873047c7417c8486823c5ea7b2ece3bdc33 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 e4d5ff0618bc214df9402727c9f0d1669df0d8be..69b473e146abf6fa72ee3854a807c4e626fbaa19 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 03acd514a1d910aa08441074fa7d05315d195a60..1d016368237f391d101636d097a1138176a41ec0 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 680056fc1c2cbbb3488fafe7b0f5c2e3bd430c0a..8d9c1015d9c22481d9a67aa9b3fa112cbec27d63 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 0d49cf395572de1550bf6647cb3c7bfbc7269602..f50e945df35e958823e539c1d69c7aa93d38756a 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 56f269b00868f007e22d873fb0502c96a9828ff2..507fd4df1004d22fccfce2cce31821c9c958e476 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 bb77e6ac43baf7bff98dcfebd89c843d7618f6ff..c629981541b4a879b5705814ac1539f7c9973dde 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 7b2c8beb62f7dfafefb5e217ea1270e2442c766d..2e926b7593808070ab65be36902b01483945e2ac 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 a7e00adf0c7ffac66ef8e29ef715f5217bee178f..12e5cf1b769e1c23dccae1540c8325d5d0c8090b 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), )