From 4fd48c02acb46500b832a3a90f89ceea4735f9f8 Mon Sep 17 00:00:00 2001 From: tidely <43219534+tidely@users.noreply.github.com> Date: Fri, 13 Nov 2026 11:45:35 +0000 Subject: [PATCH] Miscellaneous improvements to prepare for Rust 1.100 (#66901) ## Summary Fixes rustc and clippy warnings for a potential upcoming Rust 1.100 version bump. All changes are backwards compatible and Rust is **not** bumped in this PR. ## Self-review - [x] I've reviewed my diff for quality, security, reliability, and performance. - [x] UI changes follow the [checklist](https://zed.dev/docs/development/ui-checklist). - [x] Tests cover the new or changed behavior. Release Notes: - N/A - [GPUI] N/A --------- Co-authored-by: Finn Evers --- Cargo.lock | 1 - Cargo.toml | 1 - crates/acp_thread/src/acp_thread.rs | 4 ++-- crates/agent/src/agent.rs | 2 +- crates/agent/src/thread.rs | 6 +++--- crates/agent_ui/src/agent_diff.rs | 2 +- .../src/conversation_view/thread_view.rs | 2 +- crates/agent_ui/src/entry_view_state.rs | 2 +- crates/agent_ui/src/mode_selector.rs | 2 +- crates/buffer_diff/src/buffer_diff.rs | 2 +- crates/codestral/Cargo.toml | 3 +++ crates/collab/src/db/queries/rooms.rs | 2 +- crates/collab/src/rpc.rs | 8 ++++---- crates/collab/src/rpc/connection_pool.rs | 6 +----- .../random_project_collaboration_tests.rs | 2 +- crates/debugger_ui/src/dropdown_menus.rs | 4 ++-- crates/debugger_ui/src/new_process_modal.rs | 3 +-- .../src/session/running/stack_frame_list.rs | 2 +- .../dev_container/src/devcontainer_manifest.rs | 8 ++++---- crates/diagnostics/src/diagnostics.rs | 2 +- .../src/assemble_excerpts.rs | 2 +- .../src/edit_prediction_context.rs | 2 +- .../src/patch_metrics.rs | 6 +----- crates/editor/src/display_map.rs | 6 +----- crates/editor/src/display_map/fold_map.rs | 7 +++---- crates/editor/src/editor.rs | 5 +---- crates/etw_tracing/Cargo.toml | 3 +++ crates/etw_tracing/etw_tracing.rs | 4 +--- .../capabilities/download_file_capability.rs | 6 +----- .../capabilities/process_exec_capability.rs | 6 +----- crates/extension_host/src/extension_host.rs | 4 ++-- crates/fs/src/fs_watcher.rs | 2 +- crates/git_ui/src/conflict_view.rs | 2 +- crates/git_ui/src/git_panel.rs | 2 +- crates/git_ui_core/src/worktree_service.rs | 2 +- crates/gpui/src/geometry.rs | 2 +- crates/gpui/src/profiler.rs | 9 ++++----- crates/gpui/src/profiler/journal.rs | 2 +- crates/gpui/src/window.rs | 2 +- crates/gpui_ios/Cargo.toml | 3 +-- crates/gpui_linux/src/linux/x11/clipboard.rs | 2 +- crates/gpui_wgpu/src/cosmic_text_system.rs | 3 +-- crates/gpui_windows/Cargo.toml | 3 +-- crates/keymap_editor/src/keymap_editor.rs | 2 +- crates/language/src/buffer.rs | 2 +- crates/language_core/Cargo.toml | 3 +++ crates/language_core/src/highlight_cache.rs | 2 +- crates/language_model/src/language_model.rs | 2 +- crates/language_tools/src/lsp_button.rs | 13 +++++-------- crates/livekit_client/Cargo.toml | 10 +++------- crates/markdown/src/markdown.rs | 18 ++++++++---------- crates/markdown/src/parser.rs | 9 +++------ crates/multi_buffer/src/multi_buffer.rs | 4 ++-- crates/multi_buffer/src/multi_buffer_tests.rs | 2 +- crates/open_ai/src/completion.rs | 8 ++++---- crates/outline_panel/src/outline_panel.rs | 1 - crates/project/src/agent_server_store.rs | 6 +++--- crates/project/src/debugger/session.rs | 3 +-- .../project/src/git_store/diff_buffer_list.rs | 2 +- crates/project/src/lsp_store.rs | 2 +- .../project/src/lsp_store/document_symbols.rs | 2 +- crates/project/src/worktree_store.rs | 2 +- .../tests/integration/bookmark_store.rs | 2 +- .../tests/integration/color_extractor.rs | 16 +++++----------- crates/remote/src/transport/ssh.rs | 2 +- crates/sandbox/Cargo.toml | 3 ++- crates/settings_ui/src/settings_ui.rs | 2 +- crates/sidebar/src/sidebar.rs | 4 +--- crates/text/src/tests.rs | 2 +- crates/title_bar/src/title_bar.rs | 1 - crates/vim/src/motion.rs | 2 +- crates/vim/src/normal/repeat.rs | 5 +---- crates/vim/src/object.rs | 2 +- crates/vim/src/state.rs | 2 +- crates/watch/src/watch.rs | 2 +- crates/workspace/src/persistence.rs | 10 ++++------ crates/workspace/src/workspace.rs | 2 +- crates/worktree/src/worktree.rs | 14 ++++++-------- .../tests/integration/worktree_tests.rs | 10 ++++------ crates/zeta_prompt/src/hashed_regions.rs | 4 ++-- crates/ztracing_macro/Cargo.toml | 3 +++ 81 files changed, 139 insertions(+), 191 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6a814c73755..3c34c0b32f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10161,7 +10161,6 @@ dependencies = [ "postage", "rodio", "serde", - "serde_json", "serde_urlencoded", "settings", "simplelog", diff --git a/Cargo.toml b/Cargo.toml index 31427aed639..46d884889e8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -829,7 +829,6 @@ objc2-user-notifications = { version = "0.3", default-features = false, features ] } octocrab = { version = "0.49", default-features = false } oo7 = { git = "https://github.com/zed-industries/oo7", rev = "731c1215edb6905876c6137ab300428c7b8d7c13", version = "0.6", default-features = false } -open = "5.0.0" ordered-float = "5" palette = { version = "0.7.5", default-features = false, features = ["std"] } parking_lot = "0.12.1" diff --git a/crates/acp_thread/src/acp_thread.rs b/crates/acp_thread/src/acp_thread.rs index 7498d4ced32..0d6ae819359 100644 --- a/crates/acp_thread/src/acp_thread.rs +++ b/crates/acp_thread/src/acp_thread.rs @@ -14275,7 +14275,7 @@ mod tests { ), ( json!({"messageId": "patch", "content": replacement}), - replacement.clone(), + replacement, json!({}), ), ( @@ -14290,7 +14290,7 @@ mod tests { ), ( json!({"messageId": "patch", "content": original, "_meta": {"restored": true}}), - original.clone(), + original, json!({"restored": true}), ), ( diff --git a/crates/agent/src/agent.rs b/crates/agent/src/agent.rs index f20cd33e099..56d63391d39 100644 --- a/crates/agent/src/agent.rs +++ b/crates/agent/src/agent.rs @@ -473,7 +473,7 @@ impl LanguageModels { } if !provider_models.is_empty() { language_model_list.insert( - acp_thread::AgentModelGroupName(provider.name().0.clone()), + acp_thread::AgentModelGroupName(provider.name().0), provider_models, ); } diff --git a/crates/agent/src/thread.rs b/crates/agent/src/thread.rs index c86acc7a7a0..0e6086cccda 100644 --- a/crates/agent/src/thread.rs +++ b/crates/agent/src/thread.rs @@ -1623,7 +1623,7 @@ impl Thread { compaction_id.clone(), acp_thread::ContextCompactionStatus::Completed, ); - stream.send_context_compaction_update(compaction_id.clone(), summary); + stream.send_context_compaction_update(compaction_id, summary); } CompactionInfo::ProviderNative { .. } => { stream.send_context_compaction( @@ -3242,7 +3242,7 @@ impl Thread { if let Some(fallback) = maybe_fallback { log::info!("Refusal fallback: retrying with {}", fallback.id().0); - let fallback_name = fallback.name().0.clone(); + let fallback_name = fallback.name().0; this.update(cx, |this, cx| { this.pending_message = None; this.set_model(fallback.clone(), cx); @@ -4484,7 +4484,7 @@ impl Thread { let available = MAX_TOOL_NAME_LENGTH.saturating_sub(tool_name.len()); if available >= 2 { let mut disambiguated = - provider_compatible_tool_name(&server_id.0.to_snake_case()).to_string(); + provider_compatible_tool_name(&server_id.0.to_snake_case()); disambiguated.truncate(available - 1); disambiguated.push('_'); disambiguated.push_str(&tool_name); diff --git a/crates/agent_ui/src/agent_diff.rs b/crates/agent_ui/src/agent_diff.rs index b79651c4a12..fc0aee8a81e 100644 --- a/crates/agent_ui/src/agent_diff.rs +++ b/crates/agent_ui/src/agent_diff.rs @@ -407,7 +407,7 @@ fn reject_edits_in_ranges( let buffer = multibuffer.read(cx).buffer(hunk.buffer_id); if let Some(buffer) = buffer { ranges_by_buffer - .entry(buffer.clone()) + .entry(buffer) .or_insert_with(Vec::new) .push(hunk.buffer_range.clone()); } diff --git a/crates/agent_ui/src/conversation_view/thread_view.rs b/crates/agent_ui/src/conversation_view/thread_view.rs index f03c8b8ae80..52456459425 100644 --- a/crates/agent_ui/src/conversation_view/thread_view.rs +++ b/crates/agent_ui/src/conversation_view/thread_view.rs @@ -6645,7 +6645,7 @@ impl ThreadView { .toggleable(IconPosition::End, is_selected); menu.push_item(entry.handler({ - let effort = effort_level.value.clone(); + let effort = effort_level.value; let weak_self = weak_self.clone(); move |_window, cx| { let effort = effort.clone(); diff --git a/crates/agent_ui/src/entry_view_state.rs b/crates/agent_ui/src/entry_view_state.rs index f6d569d1721..3677c56baf3 100644 --- a/crates/agent_ui/src/entry_view_state.rs +++ b/crates/agent_ui/src/entry_view_state.rs @@ -439,7 +439,7 @@ impl EntryViewState { let element = create_terminal( self.workspace.clone(), self.project.clone(), - terminal.clone(), + terminal, window, cx, ) diff --git a/crates/agent_ui/src/mode_selector.rs b/crates/agent_ui/src/mode_selector.rs index e6ff74f849e..9da6e94c8b3 100644 --- a/crates/agent_ui/src/mode_selector.rs +++ b/crates/agent_ui/src/mode_selector.rs @@ -112,7 +112,7 @@ impl ModeSelector { }; menu.push_item(entry.handler({ - let mode_id = mode.value.clone(); + let mode_id = mode.value; let weak_self = weak_self.clone(); move |_window, cx| { weak_self diff --git a/crates/buffer_diff/src/buffer_diff.rs b/crates/buffer_diff/src/buffer_diff.rs index 1331e9e90aa..4e28b2cba47 100644 --- a/crates/buffer_diff/src/buffer_diff.rs +++ b/crates/buffer_diff/src/buffer_diff.rs @@ -993,7 +993,7 @@ impl BufferDiffSnapshot { log::debug!("unstaging hunk {:?}", buffer_offset_range); Arc::from( head_text - .chunks_in_range(diff_base_byte_range.clone()) + .chunks_in_range(diff_base_byte_range) .collect::(), ) }; diff --git a/crates/codestral/Cargo.toml b/crates/codestral/Cargo.toml index 812820c2b56..2d7fefe2b30 100644 --- a/crates/codestral/Cargo.toml +++ b/crates/codestral/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true publish = false license = "GPL-3.0-or-later" +[lints] +workspace = true + [lib] path = "src/codestral.rs" test = false diff --git a/crates/collab/src/db/queries/rooms.rs b/crates/collab/src/db/queries/rooms.rs index 91bc81b24e0..3c00a2a4b39 100644 --- a/crates/collab/src/db/queries/rooms.rs +++ b/crates/collab/src/db/queries/rooms.rs @@ -740,7 +740,7 @@ impl Database { while let Some(db_status) = db_statuses.next().await { let db_status: project_repository_statuses::Model = db_status?; if db_status.is_deleted { - removed_statuses.push(db_status.repo_path.clone()); + removed_statuses.push(db_status.repo_path); } else { updated_statuses.push(db_status_to_proto(db_status)?); } diff --git a/crates/collab/src/rpc.rs b/crates/collab/src/rpc.rs index 647298c5895..e26dfb33cb9 100644 --- a/crates/collab/src/rpc.rs +++ b/crates/collab/src/rpc.rs @@ -2097,7 +2097,7 @@ async fn join_project( removed_repositories: Default::default(), }; for update in proto::split_worktree_update(message) { - session.peer.send(session.connection_id, update.clone())?; + session.peer.send(session.connection_id, update)?; } // Stream this worktree's diagnostics. @@ -3030,7 +3030,7 @@ async fn create_channel( channels: vec![channel.to_proto()], ..Default::default() }; - session.peer.send(connection_id, update.clone())?; + session.peer.send(connection_id, update)?; } Ok(()) @@ -3306,7 +3306,7 @@ async fn move_channel( ..Default::default() }; - session.peer.send(connection_id, update.clone())?; + session.peer.send(connection_id, update)?; } response.send(Ack {})?; @@ -3350,7 +3350,7 @@ async fn reorder_channel( ..Default::default() }; - session.peer.send(connection_id, update.clone())?; + session.peer.send(connection_id, update)?; } } diff --git a/crates/collab/src/rpc/connection_pool.rs b/crates/collab/src/rpc/connection_pool.rs index 2dc790ea232..e57b6e13860 100644 --- a/crates/collab/src/rpc/connection_pool.rs +++ b/crates/collab/src/rpc/connection_pool.rs @@ -32,11 +32,7 @@ impl ZedVersion { pub fn can_collaborate(&self) -> bool { // v0.204.1 was the first version after the auto-update bug. // We reject any clients older than that to hope we can persuade them to upgrade. - if self.0 < Version::new(0, 204, 1) { - return false; - } - - true + self.0 >= Version::new(0, 204, 1) } } diff --git a/crates/collab/tests/integration/random_project_collaboration_tests.rs b/crates/collab/tests/integration/random_project_collaboration_tests.rs index 58862784038..c41b3f7b515 100644 --- a/crates/collab/tests/integration/random_project_collaboration_tests.rs +++ b/crates/collab/tests/integration/random_project_collaboration_tests.rs @@ -1149,7 +1149,7 @@ impl RandomizedTest for ProjectCollaborationTest { let range = if start > end { end..start } else { start..end }; highlights.push(lsp::DocumentHighlight { - range: range_to_lsp(range.clone()).unwrap(), + range: range_to_lsp(range).unwrap(), kind: Some(lsp::DocumentHighlightKind::READ), }); } diff --git a/crates/debugger_ui/src/dropdown_menus.rs b/crates/debugger_ui/src/dropdown_menus.rs index 1fb7f901540..4e92de6132d 100644 --- a/crates/debugger_ui/src/dropdown_menus.rs +++ b/crates/debugger_ui/src/dropdown_menus.rs @@ -103,7 +103,7 @@ impl DebugPanel { { sessions_with_children.next(); SessionListEntry { - leaf: single_child.clone(), + leaf: single_child, ancestors: vec![root.clone()], } } else { @@ -197,7 +197,7 @@ impl DebugPanel { }, { let weak = weak.clone(); - let leaf = session_entry.leaf.clone(); + let leaf = session_entry.leaf; move |window, cx| { weak.update(cx, |panel, cx| { panel.activate_session(leaf.clone(), window, cx); diff --git a/crates/debugger_ui/src/new_process_modal.rs b/crates/debugger_ui/src/new_process_modal.rs index ba46a78ec3b..1a6cb223778 100644 --- a/crates/debugger_ui/src/new_process_modal.rs +++ b/crates/debugger_ui/src/new_process_modal.rs @@ -5,7 +5,6 @@ use std::{ borrow::Cow, path::{Path, PathBuf}, sync::Arc, - usize, }; use tasks_ui::{TaskOverrides, TasksModal}; @@ -515,7 +514,7 @@ impl NewProcessModal { }; for adapter in available_adapters.into_iter() { - menu = menu.entry(adapter.0.clone(), None, setter_for_name(adapter.clone())); + menu = menu.entry(adapter.0.clone(), None, setter_for_name(adapter)); } menu diff --git a/crates/debugger_ui/src/session/running/stack_frame_list.rs b/crates/debugger_ui/src/session/running/stack_frame_list.rs index 41239c7a5c9..c5e679d3866 100644 --- a/crates/debugger_ui/src/session/running/stack_frame_list.rs +++ b/crates/debugger_ui/src/session/running/stack_frame_list.rs @@ -311,7 +311,7 @@ impl StackFrameList { _ => { let collapsed_entries = std::mem::take(&mut collapsed_entries); if !collapsed_entries.is_empty() { - entries.push(StackFrameEntry::Collapsed(collapsed_entries.clone())); + entries.push(StackFrameEntry::Collapsed(collapsed_entries)); } first_stack_frame.get_or_insert(entries.len()); diff --git a/crates/dev_container/src/devcontainer_manifest.rs b/crates/dev_container/src/devcontainer_manifest.rs index e0d216f9502..d3ff9455a09 100644 --- a/crates/dev_container/src/devcontainer_manifest.rs +++ b/crates/dev_container/src/devcontainer_manifest.rs @@ -884,7 +884,7 @@ RUN sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1\${{PATH:-\3}}/g' /etc/profile || true ]; for entrypoint in self.features.iter().filter_map(|f| f.entrypoint()) { - entrypoint_script_lines.push(entrypoint.clone()); + entrypoint_script_lines.push(entrypoint); } entrypoint_script_lines.append(&mut vec![ "exec \"$@\"".to_string(), @@ -1505,7 +1505,7 @@ RUN sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1\${{PATH:-\3}}/g' /etc/profile || true if let Some(service) = service_declarations.get_mut(network_service_name) { service.ports.push(DockerComposeServicePort { target: port.clone(), - published: port.clone(), + published: port, ..Default::default() }); } else { @@ -1514,7 +1514,7 @@ RUN sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1\${{PATH:-\3}}/g' /etc/profile || true DockerComposeService { ports: vec![DockerComposeServicePort { target: port.clone(), - published: port.clone(), + published: port, ..Default::default() }], ..Default::default() @@ -1524,7 +1524,7 @@ RUN sed -i -E 's/((^|\s)PATH=)([^\$]*)$/\1\${{PATH:-\3}}/g' /etc/profile || true } else { main_service.ports.push(DockerComposeServicePort { target: port.clone(), - published: port.clone(), + published: port, ..Default::default() }); } diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs index 6534602aa73..368c1546fdc 100644 --- a/crates/diagnostics/src/diagnostics.rs +++ b/crates/diagnostics/src/diagnostics.rs @@ -695,7 +695,7 @@ impl ProjectDiagnosticsEditor { for (block_id, block) in block_ids.iter().zip(cloned_blocks.into_iter().flatten()) { - let markdown = block.markdown.clone(); + let markdown = block.markdown; editor::test::set_block_content_for_tests( &this.editor, *block_id, diff --git a/crates/edit_prediction_context/src/assemble_excerpts.rs b/crates/edit_prediction_context/src/assemble_excerpts.rs index 97b83653f53..57ca60905e6 100644 --- a/crates/edit_prediction_context/src/assemble_excerpts.rs +++ b/crates/edit_prediction_context/src/assemble_excerpts.rs @@ -36,7 +36,7 @@ pub fn assemble_excerpt_ranges( }); add_outline_item( - item_range.clone(), + item_range, body_range.clone(), *input_order, buffer, diff --git a/crates/edit_prediction_context/src/edit_prediction_context.rs b/crates/edit_prediction_context/src/edit_prediction_context.rs index 8bd01b47f5d..6ec4f70042a 100644 --- a/crates/edit_prediction_context/src/edit_prediction_context.rs +++ b/crates/edit_prediction_context/src/edit_prediction_context.rs @@ -653,7 +653,7 @@ fn identifiers_for_position( if let Some(body_range) = item.body_range(&buffer) { ranges.push(item.range.start..body_range.start.to_offset(&buffer)); } else { - ranges.push(item.range.clone()); + ranges.push(item.range); } } diff --git a/crates/edit_prediction_metrics/src/patch_metrics.rs b/crates/edit_prediction_metrics/src/patch_metrics.rs index c913f9a7e4b..523f1d91277 100644 --- a/crates/edit_prediction_metrics/src/patch_metrics.rs +++ b/crates/edit_prediction_metrics/src/patch_metrics.rs @@ -561,11 +561,7 @@ pub fn is_editable_region_correct(actual_patch: &str) -> bool { } } - if deletions_at_start >= 3 { - return false; - } - - true + deletions_at_start < 3 } #[derive(Debug, Default, Clone, Serialize)] diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index f4e652c7aa4..e759efc4111 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -437,16 +437,12 @@ impl DisplayMap { }]); self.block_map.deferred_edits.set(edits); self.block_map.retain_blocks_raw(&mut |block| { - if companion + !companion .read(cx) .lhs_custom_block_to_balancing_block .borrow() .values() .any(|id| *id == block.id) - { - return false; - } - true }); return; }; diff --git a/crates/editor/src/display_map/fold_map.rs b/crates/editor/src/display_map/fold_map.rs index 32a810d650e..ec0158bf109 100644 --- a/crates/editor/src/display_map/fold_map.rs +++ b/crates/editor/src/display_map/fold_map.rs @@ -17,7 +17,6 @@ use std::{ fmt, iter, ops::{Add, AddAssign, Deref, DerefMut, Range, Sub, SubAssign}, sync::Arc, - usize, }; use sum_tree::{Bias, Cursor, Dimensions, FilterCursor, SumTree, Summary, TreeMap}; use ui::IntoElement as _; @@ -274,7 +273,7 @@ impl FoldMapWriter<'_> { for range in ranges.into_iter() { let range = range.start.to_offset(buffer)..range.end.to_offset(buffer); let mut folds_cursor = - intersecting_folds(&snapshot, &self.0.snapshot.folds, range.clone(), inclusive); + intersecting_folds(&snapshot, &self.0.snapshot.folds, range, inclusive); while let Some(fold) = folds_cursor.item() { let offset_range = fold.range.start.to_offset(buffer)..fold.range.end.to_offset(buffer); @@ -335,7 +334,7 @@ impl FoldMapWriter<'_> { ..inlay_snapshot.to_inlay_offset(buffer_end); edits.push(InlayEdit { old: inlay_range.clone(), - new: inlay_range.clone(), + new: inlay_range, }); self.0.snapshot.fold_metadata_by_id.insert( @@ -2125,7 +2124,7 @@ mod tests { let (snapshot, edits) = map.read(inlay_snapshot.clone(), inlay_edits); snapshot_edits.push((snapshot.clone(), edits)); - let mut expected_text: String = inlay_snapshot.text().to_string(); + let mut expected_text: String = inlay_snapshot.text(); for fold_range in map.merged_folds().into_iter().rev() { let fold_inlay_start = inlay_snapshot.to_inlay_offset(fold_range.start); let fold_inlay_end = inlay_snapshot.to_inlay_offset(fold_range.end); diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index 335a6c48fa1..22a0f0a37a4 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -4898,10 +4898,7 @@ impl Editor { // Fill in the environmental variables from the tree-sitter captures let mut captured_task_variables = TaskVariables::default(); for (capture_name, value) in tasks.extra_variables.clone() { - captured_task_variables.insert( - task::VariableName::Custom(capture_name.into()), - value.clone(), - ); + captured_task_variables.insert(task::VariableName::Custom(capture_name.into()), value); } project.update(cx, |project, cx| { project.task_store().update(cx, |task_store, cx| { diff --git a/crates/etw_tracing/Cargo.toml b/crates/etw_tracing/Cargo.toml index ac14eb923fa..42140fb1d34 100644 --- a/crates/etw_tracing/Cargo.toml +++ b/crates/etw_tracing/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true publish.workspace = true license = "GPL-3.0-or-later" +[lints] +workspace = true + [lib] path = "etw_tracing.rs" test = false diff --git a/crates/etw_tracing/etw_tracing.rs b/crates/etw_tracing/etw_tracing.rs index f77cf2a7788..c276f65ea1b 100644 --- a/crates/etw_tracing/etw_tracing.rs +++ b/crates/etw_tracing/etw_tracing.rs @@ -153,9 +153,7 @@ fn save_etw_recording(output_path: PathBuf, cx: &mut App) { return; } - let command = Command::Save { - output_path: output_path.clone(), - }; + let command = Command::Save { output_path }; match send_json(&mut session.writer, &command) { Ok(()) => { session.state = EtwSessionState::Stopping; diff --git a/crates/extension/src/capabilities/download_file_capability.rs b/crates/extension/src/capabilities/download_file_capability.rs index a76755b593a..cdf1ae3b991 100644 --- a/crates/extension/src/capabilities/download_file_capability.rs +++ b/crates/extension/src/capabilities/download_file_capability.rs @@ -38,11 +38,7 @@ impl DownloadFileCapability { } } - if self.path.len() < desired_path.len() { - return false; - } - - true + self.path.len() >= desired_path.len() } } diff --git a/crates/extension/src/capabilities/process_exec_capability.rs b/crates/extension/src/capabilities/process_exec_capability.rs index 053a7b212b9..5a288f215b9 100644 --- a/crates/extension/src/capabilities/process_exec_capability.rs +++ b/crates/extension/src/capabilities/process_exec_capability.rs @@ -35,11 +35,7 @@ impl ProcessExecCapability { } } - if self.args.len() < desired_args.len() { - return false; - } - - true + self.args.len() >= desired_args.len() } } diff --git a/crates/extension_host/src/extension_host.rs b/crates/extension_host/src/extension_host.rs index a59488ecb17..9ad92374844 100644 --- a/crates/extension_host/src/extension_host.rs +++ b/crates/extension_host/src/extension_host.rs @@ -1650,7 +1650,7 @@ impl ExtensionStore { this.update(cx, |_, cx| { SettingsStore::update_global(cx, |store, _| { for (language_name, rules) in semantic_token_rules_to_add { - store.set_language_semantic_token_rules(language_name.0.clone(), rules); + store.set_language_semantic_token_rules(language_name.0, rules); } }) }) @@ -1702,7 +1702,7 @@ impl ExtensionStore { this.proxy.register_language_server( extension.clone(), language_server_id.clone(), - language.clone(), + language, ); } } diff --git a/crates/fs/src/fs_watcher.rs b/crates/fs/src/fs_watcher.rs index 79d45c2b8a7..f0154b11c3a 100644 --- a/crates/fs/src/fs_watcher.rs +++ b/crates/fs/src/fs_watcher.rs @@ -1870,7 +1870,7 @@ mod tests { .expect("watch again") .expect("registered again"); assert_eq!(backend.lock().watch_calls, [path.clone(), path.clone()]); - assert_eq!(backend.lock().watched_paths, HashSet::from([path.clone()])); + assert_eq!(backend.lock().watched_paths, HashSet::from([path])); // The backend already dropped this watch, as inotify does when a // watched directory is deleted. diff --git a/crates/git_ui/src/conflict_view.rs b/crates/git_ui/src/conflict_view.rs index 36b93064c51..cfa823174d2 100644 --- a/crates/git_ui/src/conflict_view.rs +++ b/crates/git_ui/src/conflict_view.rs @@ -216,7 +216,7 @@ fn conflicts_updated( let Some(range) = snapshot.buffer_anchor_range_to_anchor_range(conflict_range) else { continue; }; - removed_highlighted_ranges.push(range.clone()); + removed_highlighted_ranges.push(range); removed_block_ids.insert(block_id); } diff --git a/crates/git_ui/src/git_panel.rs b/crates/git_ui/src/git_panel.rs index 84471ce3214..b6ef3385552 100644 --- a/crates/git_ui/src/git_panel.rs +++ b/crates/git_ui/src/git_panel.rs @@ -5539,7 +5539,7 @@ impl GitPanel { .clone() .or_else(|| participant.user.name.clone()) .unwrap_or_else(|| participant.user.username.clone().to_string()); - new_co_authors.push((name.clone(), email.clone())) + new_co_authors.push((name, email.clone())) } } if !project.is_local() diff --git a/crates/git_ui_core/src/worktree_service.rs b/crates/git_ui_core/src/worktree_service.rs index 1a20d69e29b..5633406fe49 100644 --- a/crates/git_ui_core/src/worktree_service.rs +++ b/crates/git_ui_core/src/worktree_service.rs @@ -1009,7 +1009,7 @@ async fn do_create_worktree( { existing_worktree_names.push(name.to_string()); } - existing_worktree_paths.insert(worktree.path.clone()); + existing_worktree_paths.insert(worktree.path); } } Ok(Err(err)) => { diff --git a/crates/gpui/src/geometry.rs b/crates/gpui/src/geometry.rs index 8d7c496c1ec..df59ce8c780 100644 --- a/crates/gpui/src/geometry.rs +++ b/crates/gpui/src/geometry.rs @@ -3816,7 +3816,7 @@ pub const fn relative(fraction: f32) -> DefiniteLength { /// Returns the Golden Ratio, i.e. `~(1.0 + sqrt(5.0)) / 2.0`. pub const fn phi() -> DefiniteLength { - relative(1.618_034) + relative(std::f32::consts::GOLDEN_RATIO) } /// Constructs a `Rems` value representing a length in rems. diff --git a/crates/gpui/src/profiler.rs b/crates/gpui/src/profiler.rs index d78ccb9de81..18e639a31b4 100644 --- a/crates/gpui/src/profiler.rs +++ b/crates/gpui/src/profiler.rs @@ -741,7 +741,7 @@ pub(crate) struct TraceGuard; #[cfg(any(feature = "bench-support", all(test, feature = "profiler")))] pub(crate) fn trace_scope() -> TraceGuard { - let incremented = TRACE_STATE.fetch_update(Ordering::AcqRel, Ordering::Acquire, |state| { + let incremented = TRACE_STATE.try_update(Ordering::AcqRel, Ordering::Acquire, |state| { (state & TRACE_SCOPE_COUNT_MASK < TRACE_SCOPE_COUNT_MASK).then_some(state + 1) }); assert!(incremented.is_ok(), "too many active profiler trace scopes"); @@ -751,10 +751,9 @@ pub(crate) fn trace_scope() -> TraceGuard { #[cfg(any(feature = "bench-support", all(test, feature = "profiler")))] impl Drop for TraceGuard { fn drop(&mut self) { - let previous_state = - TRACE_STATE.fetch_update(Ordering::AcqRel, Ordering::Acquire, |state| { - (state & TRACE_SCOPE_COUNT_MASK > 0).then_some(state - 1) - }); + let previous_state = TRACE_STATE.try_update(Ordering::AcqRel, Ordering::Acquire, |state| { + (state & TRACE_SCOPE_COUNT_MASK > 0).then_some(state - 1) + }); match previous_state { Ok(1) => clear_trace_buffers(), Ok(_) => {} diff --git a/crates/gpui/src/profiler/journal.rs b/crates/gpui/src/profiler/journal.rs index 28c66b6e809..e5e8bc706b8 100644 --- a/crates/gpui/src/profiler/journal.rs +++ b/crates/gpui/src/profiler/journal.rs @@ -442,7 +442,7 @@ impl ForegroundRunnableCounter { fn finished(&self) { let _ = self .0 - .fetch_update(Ordering::AcqRel, Ordering::Acquire, |count| { + .try_update(Ordering::AcqRel, Ordering::Acquire, |count| { count.checked_sub(1) }); } diff --git a/crates/gpui/src/window.rs b/crates/gpui/src/window.rs index f408e9dfea7..12fd517f362 100644 --- a/crates/gpui/src/window.rs +++ b/crates/gpui/src/window.rs @@ -5565,7 +5565,7 @@ impl Window { frame_index, }; - self.sprite_atlas.remove(¶ms.clone().into()); + self.sprite_atlas.remove(¶ms.into()); } Ok(()) diff --git a/crates/gpui_ios/Cargo.toml b/crates/gpui_ios/Cargo.toml index bc5ad869700..0544070bf68 100644 --- a/crates/gpui_ios/Cargo.toml +++ b/crates/gpui_ios/Cargo.toml @@ -27,8 +27,6 @@ harness = false [features] runtime_shaders = ["gpui_apple/runtime_shaders"] -[dependencies] -gpui.workspace = true [target.'cfg(target_os = "ios")'.dev-dependencies] gpui_platform.workspace = true @@ -39,6 +37,7 @@ slotmap.workspace = true anyhow.workspace = true block2.workspace = true futures.workspace = true +gpui.workspace = true gpui_apple = { workspace = true, features = ["font-kit"] } log.workspace = true objc2.workspace = true diff --git a/crates/gpui_linux/src/linux/x11/clipboard.rs b/crates/gpui_linux/src/linux/x11/clipboard.rs index 9835786efe8..ef6976e8e55 100644 --- a/crates/gpui_linux/src/linux/x11/clipboard.rs +++ b/crates/gpui_linux/src/linux/x11/clipboard.rs @@ -12,7 +12,7 @@ * The project to which this file belongs is licensed under either of * the Apache 2.0 or the MIT license at the licensee's choice. The terms * and conditions of the chosen license apply to this file. -*/ + */ // More info about using the clipboard on X11: // https://tronche.com/gui/x/icccm/sec-2.html#s-2.6 diff --git a/crates/gpui_wgpu/src/cosmic_text_system.rs b/crates/gpui_wgpu/src/cosmic_text_system.rs index 7d738affa57..eafe97442b7 100644 --- a/crates/gpui_wgpu/src/cosmic_text_system.rs +++ b/crates/gpui_wgpu/src/cosmic_text_system.rs @@ -364,8 +364,7 @@ impl CosmicTextSystemState { cached.clone() } else { let loaded = self.load_family(fallback_name, features, None)?; - self.font_ids_by_family_cache - .insert(fb_key.clone(), loaded.clone()); + self.font_ids_by_family_cache.insert(fb_key, loaded.clone()); loaded }; let Some(&fb_id) = fb_ids.first() else { diff --git a/crates/gpui_windows/Cargo.toml b/crates/gpui_windows/Cargo.toml index 37e4a2f7f22..83e2d2d02d8 100644 --- a/crates/gpui_windows/Cargo.toml +++ b/crates/gpui_windows/Cargo.toml @@ -17,8 +17,6 @@ default = ["gpui/default"] test-support = ["gpui/test-support"] screen-capture = ["gpui/screen-capture", "scap"] -[dependencies] -gpui.workspace = true [target.'cfg(target_os = "windows")'.dependencies] accesskit.workspace = true @@ -28,6 +26,7 @@ collections.workspace = true dunce.workspace = true etagere.workspace = true futures.workspace = true +gpui.workspace = true gpui_util.workspace = true image.workspace = true itertools.workspace = true diff --git a/crates/keymap_editor/src/keymap_editor.rs b/crates/keymap_editor/src/keymap_editor.rs index c0f117bb880..8ea4f82c4db 100644 --- a/crates/keymap_editor/src/keymap_editor.rs +++ b/crates/keymap_editor/src/keymap_editor.rs @@ -334,7 +334,7 @@ impl ConflictState { .context .and_then(|ctx| gpui::KeyBindingContextPredicate::parse(&ctx).ok()); let entry = action_keybind_mapping - .entry(mapping.keystrokes.clone()) + .entry(mapping.keystrokes) .or_default(); let origin = ConflictOrigin::new(binding.source, index); if let Some((_, origins)) = diff --git a/crates/language/src/buffer.rs b/crates/language/src/buffer.rs index 084f621488a..f6d2bf19fd7 100644 --- a/crates/language/src/buffer.rs +++ b/crates/language/src/buffer.rs @@ -1456,7 +1456,7 @@ impl Buffer { if is_included { edits.push(( edit.old.clone(), - self.text_for_range(edit.new.clone()).collect::(), + self.text_for_range(edit.new).collect::(), )); } } diff --git a/crates/language_core/Cargo.toml b/crates/language_core/Cargo.toml index 5b5dada8afd..a3dbabed556 100644 --- a/crates/language_core/Cargo.toml +++ b/crates/language_core/Cargo.toml @@ -4,6 +4,9 @@ version = "0.1.0" edition.workspace = true publish = false +[lints] +workspace = true + [lib] path = "src/language_core.rs" doctest = false diff --git a/crates/language_core/src/highlight_cache.rs b/crates/language_core/src/highlight_cache.rs index 07cc1fd99a5..3d45706347e 100644 --- a/crates/language_core/src/highlight_cache.rs +++ b/crates/language_core/src/highlight_cache.rs @@ -381,7 +381,7 @@ mod tests { cache .get(&small_key, [small_text].into_iter()) .map(|highlights| highlights.runs), - Some(small_highlights.runs.clone()), + Some(small_highlights.runs), "highlights within the entry budget must be cached as-is" ); diff --git a/crates/language_model/src/language_model.rs b/crates/language_model/src/language_model.rs index bdd8b0fabd1..b9ddec4678c 100644 --- a/crates/language_model/src/language_model.rs +++ b/crates/language_model/src/language_model.rs @@ -748,7 +748,7 @@ impl LanguageModelCostInfo { } fn cost_value_to_string(cost: &f64) -> SharedString { - if (cost.fract() - 0.0).abs() < std::f64::EPSILON { + if (cost.fract() - 0.0).abs() < f64::EPSILON { SharedString::from(format!("{:.0}", cost)) } else { SharedString::from(format!("{:.2}", cost)) diff --git a/crates/language_tools/src/lsp_button.rs b/crates/language_tools/src/lsp_button.rs index 21812a89cd2..d339bd6a8b8 100644 --- a/crates/language_tools/src/lsp_button.rs +++ b/crates/language_tools/src/lsp_button.rs @@ -404,8 +404,6 @@ impl LanguageServerState { status_color, { let lsp_logs = lsp_logs.clone(); - let message = message.clone(); - let server_selector = server_selector.clone(); let workspace = self.workspace.clone(); let lsp_store = self.lsp_store.clone(); let state = cx.entity().downgrade(); @@ -1164,7 +1162,7 @@ impl LspButton { }; if let Some(worktree_name) = worktree_name { servers_per_worktree - .entry(worktree_name.clone()) + .entry(worktree_name) .or_default() .push(server_data); } @@ -1210,14 +1208,13 @@ impl LspButton { .or_else(|| worktrees_for_name.iter().next()) { let worktree_name = SharedString::new(worktree.read(cx).root_name_str()); - servers_per_worktree - .entry(worktree_name.clone()) - .or_default() - .push(ServerData::WithBinaryStatus { + servers_per_worktree.entry(worktree_name).or_default().push( + ServerData::WithBinaryStatus { server_name, binary_status, server_id: *server_id, - }); + }, + ); } } diff --git a/crates/livekit_client/Cargo.toml b/crates/livekit_client/Cargo.toml index 022ab3484a4..651854ed297 100644 --- a/crates/livekit_client/Cargo.toml +++ b/crates/livekit_client/Cargo.toml @@ -40,7 +40,6 @@ serde.workspace = true serde_urlencoded.workspace = true settings.workspace = true smallvec.workspace = true -ui.workspace = true util.workspace = true [target.'cfg(any(all(target_os = "windows", target_env = "gnu"), target_os = "freebsd"))'.dependencies] @@ -59,6 +58,9 @@ webrtc-sys.workspace = true [target.'cfg(any(target_os = "linux", target_os = "freebsd", target_os = "windows"))'.dependencies] scap.workspace = true +[target.'cfg(not(target_os = "macos"))'.dependencies] +ui.workspace = true + [target.'cfg(target_os = "macos")'.dependencies] objc2-core-foundation = { workspace = true, features = ["CFDictionary", "CFNumber"] } objc2-core-video = { workspace = true, features = ["CVBase", "CVPixelBuffer", "CVPixelBufferIOSurface", "CVPixelBufferPool", "CVReturn"] } @@ -73,9 +75,3 @@ nanoid.workspace = true postage = { workspace = true, features = ["futures-traits", "logging"] } simplelog.workspace = true -[build-dependencies] -serde = { workspace = true, features = ["derive"] } -serde_json.workspace = true - -[package.metadata.cargo-shear] -ignored = ["serde_json"] diff --git a/crates/markdown/src/markdown.rs b/crates/markdown/src/markdown.rs index 466d5dab2c3..7837d143905 100644 --- a/crates/markdown/src/markdown.rs +++ b/crates/markdown/src/markdown.rs @@ -3006,16 +3006,14 @@ impl Element for MarkdownElement { ) .fill(); - let checkbox = if let Some(on_toggle) = - self.on_checkbox_toggle.clone() - { - let task_source_range = task_range.clone(); - checkbox.on_click(move |_state, window, cx| { - on_toggle(task_source_range.clone(), !checked, window, cx); - }) - } else { - checkbox.visualization_only(true) - }; + let checkbox = + if let Some(on_toggle) = self.on_checkbox_toggle.clone() { + checkbox.on_click(move |_state, window, cx| { + on_toggle(task_range.clone(), !checked, window, cx); + }) + } else { + checkbox.visualization_only(true) + }; let line_height = self .style diff --git a/crates/markdown/src/parser.rs b/crates/markdown/src/parser.rs index 8ac2ea9df4a..9ec5ae3f630 100644 --- a/crates/markdown/src/parser.rs +++ b/crates/markdown/src/parser.rs @@ -575,7 +575,7 @@ pub(crate) fn parse_markdown_with_options( let mut last_len = parsed.len(); let mut ranges = vec![TextRange { - source_range: range.clone(), + source_range: range, merged_range: 0..last_len, parsed, }]; @@ -597,7 +597,7 @@ pub(crate) fn parse_markdown_with_options( }; let next_len = last_len + next_text.len(); ranges.push(TextRange { - source_range: next_range.clone(), + source_range: next_range, merged_range: last_len..next_len, parsed: next_text, }); @@ -689,10 +689,7 @@ pub(crate) fn parse_markdown_with_options( for (range, event) in link_events { state.push_event(range, event); } - state.push_event( - link_range.clone(), - MarkdownEvent::End(MarkdownTagEnd::Link), - ); + state.push_event(link_range, MarkdownEvent::End(MarkdownTagEnd::Link)); } } diff --git a/crates/multi_buffer/src/multi_buffer.rs b/crates/multi_buffer/src/multi_buffer.rs index 0787f0078d0..f5798a65d18 100644 --- a/crates/multi_buffer/src/multi_buffer.rs +++ b/crates/multi_buffer/src/multi_buffer.rs @@ -1560,7 +1560,7 @@ impl MultiBuffer { original_indent_columns.push(original_indent_column); insertions.push(( buffer.anchor_before(range.start)..buffer.anchor_before(range.end), - new_text.clone(), + new_text, )); } else if !range.is_empty() { deletions.push(( @@ -3012,7 +3012,7 @@ impl MultiBuffer { new_diff_transforms.push( DiffTransform::DeletedHunk { - base_text_byte_range: hunk.diff_base_byte_range.clone(), + base_text_byte_range: hunk.diff_base_byte_range, summary: base_text_summary, buffer_id: buffer_snapshot.remote_id(), hunk_info, diff --git a/crates/multi_buffer/src/multi_buffer_tests.rs b/crates/multi_buffer/src/multi_buffer_tests.rs index e0e20ac88aa..08a5fcc9498 100644 --- a/crates/multi_buffer/src/multi_buffer_tests.rs +++ b/crates/multi_buffer/src/multi_buffer_tests.rs @@ -6876,7 +6876,7 @@ fn check_multibuffer_edits( .text_for_range(edit.new.start..edit.new.end) .collect(); text.replace_range( - (edit.new.start.0..edit.new.start.0 + (edit.old.end.0 - edit.old.start.0)).clone(), + edit.new.start.0..edit.new.start.0 + (edit.old.end.0 - edit.old.start.0), &new_text, ); pretty_assertions::assert_eq!( diff --git a/crates/open_ai/src/completion.rs b/crates/open_ai/src/completion.rs index e4d10fb5c7c..823033db7ab 100644 --- a/crates/open_ai/src/completion.rs +++ b/crates/open_ai/src/completion.rs @@ -1179,8 +1179,8 @@ impl OpenAiResponseEventMapper { Ok(input) => { events.push(Ok(LanguageModelCompletionEvent::ToolUse( LanguageModelToolUse { - id: LanguageModelToolUseId::from(call_id.clone()), - name: name.clone(), + id: LanguageModelToolUseId::from(call_id), + name, is_input_complete: true, input: LanguageModelToolUseInput::Json(input), raw_input: arguments.clone(), @@ -1190,8 +1190,8 @@ impl OpenAiResponseEventMapper { } Err(error) => { events.push(Ok(LanguageModelCompletionEvent::ToolUseJsonParseError { - id: LanguageModelToolUseId::from(call_id.clone()), - tool_name: name.clone(), + id: LanguageModelToolUseId::from(call_id), + tool_name: name, raw_input: Arc::::from(arguments.clone()), json_parse_error: error.to_string(), })); diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index f35d5d68768..e86dc460230 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -37,7 +37,6 @@ use std::{ atomic::{self, AtomicBool}, }, time::Duration, - u32, }; use outline_panel_settings::{DockSide, FolderIndicator, OutlinePanelSettings, ShowIndentGuides}; diff --git a/crates/project/src/agent_server_store.rs b/crates/project/src/agent_server_store.rs index 1d2234f0847..794cb3ad857 100644 --- a/crates/project/src/agent_server_store.rs +++ b/crates/project/src/agent_server_store.rs @@ -362,7 +362,7 @@ impl AgentServerStore { CustomAgentServerSettings::Custom { command, .. } => { let agent_name = AgentId(name.clone().into()); self.external_agents.insert( - agent_name.clone(), + agent_name, ExternalAgentEntry::new( Box::new(LocalCustomAgent { command: command.clone(), @@ -394,7 +394,7 @@ impl AgentServerStore { } self.external_agents.insert( - agent_name.clone(), + agent_name, ExternalAgentEntry::new( Box::new(LocalRegistryArchiveAgent { fs: fs.clone(), @@ -419,7 +419,7 @@ impl AgentServerStore { } RegistryAgent::Npx(agent) => { self.external_agents.insert( - agent_name.clone(), + agent_name, ExternalAgentEntry::new( Box::new(LocalRegistryNpxAgent { fs: fs.clone(), diff --git a/crates/project/src/debugger/session.rs b/crates/project/src/debugger/session.rs index 536b02eb584..0848d9506f6 100644 --- a/crates/project/src/debugger/session.rs +++ b/crates/project/src/debugger/session.rs @@ -2791,8 +2791,7 @@ impl Session { pub fn refresh_watchers(&mut self, frame_id: u64, cx: &mut Context) { let watches = self.watchers.clone(); for (_, watch) in watches.into_iter() { - self.add_watcher(watch.expression.clone(), frame_id, cx) - .detach(); + self.add_watcher(watch.expression, frame_id, cx).detach(); } } diff --git a/crates/project/src/git_store/diff_buffer_list.rs b/crates/project/src/git_store/diff_buffer_list.rs index fb01d814cd3..8289b7baac4 100644 --- a/crates/project/src/git_store/diff_buffer_list.rs +++ b/crates/project/src/git_store/diff_buffer_list.rs @@ -378,7 +378,7 @@ impl DiffBufferList { ); output.push(DiffBuffer { - repo_path: item.repo_path.clone(), + repo_path: item.repo_path, load: task, file_status: status, }); diff --git a/crates/project/src/lsp_store.rs b/crates/project/src/lsp_store.rs index 7580df2345b..3a0138e0e03 100644 --- a/crates/project/src/lsp_store.rs +++ b/crates/project/src/lsp_store.rs @@ -6525,7 +6525,7 @@ impl LspStore { worktree_path, language.name(), language.manifest(), - delegate.clone(), + delegate, cx, ) .collect::>(); diff --git a/crates/project/src/lsp_store/document_symbols.rs b/crates/project/src/lsp_store/document_symbols.rs index 2a8698f1db0..f3d0c095bab 100644 --- a/crates/project/src/lsp_store/document_symbols.rs +++ b/crates/project/src/lsp_store/document_symbols.rs @@ -356,7 +356,7 @@ fn flatten_document_symbols( output.push(OutlineItem { depth, range, - selection_range: selection_range.clone(), + selection_range, source_range_for_text, text: text.into(), highlight_ranges: Vec::new(), diff --git a/crates/project/src/worktree_store.rs b/crates/project/src/worktree_store.rs index db59691dcb9..a491b65f88f 100644 --- a/crates/project/src/worktree_store.rs +++ b/crates/project/src/worktree_store.rs @@ -1099,7 +1099,7 @@ impl WorktreeStore { let push_strong_handle = self.retain_worktrees || old_worktree.read(cx).is_visible(); let handle = if push_strong_handle { - WorktreeHandle::Strong(old_worktree.clone()) + WorktreeHandle::Strong(old_worktree) } else { WorktreeHandle::Weak(old_worktree.downgrade()) }; diff --git a/crates/project/tests/integration/bookmark_store.rs b/crates/project/tests/integration/bookmark_store.rs index 533bc6ba16c..6841c00ca65 100644 --- a/crates/project/tests/integration/bookmark_store.rs +++ b/crates/project/tests/integration/bookmark_store.rs @@ -103,7 +103,7 @@ mod integration { for &(path_str, rows) in entries { let path = project_path(path_str); map.insert( - path.clone(), + path, rows.iter().map(|&row| serialized_bookmark(row)).collect(), ); } diff --git a/crates/project/tests/integration/color_extractor.rs b/crates/project/tests/integration/color_extractor.rs index b66b850d9c5..74a9fd6d060 100644 --- a/crates/project/tests/integration/color_extractor.rs +++ b/crates/project/tests/integration/color_extractor.rs @@ -63,7 +63,7 @@ fn only_whole_label_matches_are_allowed() { for (color_str, _) in COLOR_TABLE.iter() { let color = extract_color(&CompletionItem { kind: Some(CompletionItemKind::COLOR), - label: format!("{} foo", color_str).to_string(), + label: format!("{} foo", color_str), detail: None, documentation: None, ..Default::default() @@ -94,7 +94,7 @@ fn only_whole_detail_matches_are_allowed() { let color = extract_color(&CompletionItem { kind: Some(CompletionItemKind::COLOR), label: "".to_string(), - detail: Some(format!("{} foo", color_str).to_string()), + detail: Some(format!("{} foo", color_str)), documentation: None, ..Default::default() }); @@ -110,9 +110,7 @@ fn can_extract_from_documentation_start() { kind: Some(CompletionItemKind::COLOR), label: "".to_string(), detail: None, - documentation: Some(Documentation::String( - format!("{} foo", color_str).to_string(), - )), + documentation: Some(Documentation::String(format!("{} foo", color_str))), ..Default::default() }); @@ -127,9 +125,7 @@ fn can_extract_from_documentation_end() { kind: Some(CompletionItemKind::COLOR), label: "".to_string(), detail: None, - documentation: Some(Documentation::String( - format!("foo {}", color_str).to_string(), - )), + documentation: Some(Documentation::String(format!("foo {}", color_str))), ..Default::default() }); @@ -144,9 +140,7 @@ fn cannot_extract_from_documentation_middle() { kind: Some(CompletionItemKind::COLOR), label: "".to_string(), detail: None, - documentation: Some(Documentation::String( - format!("foo {} foo", color_str).to_string(), - )), + documentation: Some(Documentation::String(format!("foo {} foo", color_str))), ..Default::default() }); diff --git a/crates/remote/src/transport/ssh.rs b/crates/remote/src/transport/ssh.rs index 433ce4d9830..1a271d9f582 100644 --- a/crates/remote/src/transport/ssh.rs +++ b/crates/remote/src/transport/ssh.rs @@ -1916,7 +1916,7 @@ impl SshConnectionOptions { 'outer: while let Some(arg) = tokens.next() { if ALLOWED_OPTS.contains(&(&arg as &str)) { - args.push(arg.to_string()); + args.push(arg); continue; } if arg == "-p" { diff --git a/crates/sandbox/Cargo.toml b/crates/sandbox/Cargo.toml index fa47eeba441..39539da158f 100644 --- a/crates/sandbox/Cargo.toml +++ b/crates/sandbox/Cargo.toml @@ -52,10 +52,11 @@ log.workspace = true # Used only by the `nixos-test` helper binary to parse its check list; gated # behind the `nixos-test` feature so normal builds don't pull it in. serde = { workspace = true, features = ["derive"], optional = true } -serde_json = { workspace = true, optional = true } [target.'cfg(target_os = "linux")'.dependencies] libc.workspace = true +# The `nixos-test` helper binary only parses its check list on Linux. +serde_json = { workspace = true, optional = true } # Safe wrappers for the SCM_RIGHTS fd-passing and `fstat` the bind validator # needs, so that code doesn't hand-roll `msghdr`/`CMSG_*`/`mem::zeroed` unsafe. nix = { workspace = true, features = ["fs", "socket", "uio"] } diff --git a/crates/settings_ui/src/settings_ui.rs b/crates/settings_ui/src/settings_ui.rs index 26a6e9b9269..f0c45b4abf3 100644 --- a/crates/settings_ui/src/settings_ui.rs +++ b/crates/settings_ui/src/settings_ui.rs @@ -2626,7 +2626,7 @@ impl SettingsWindow { continue; }; - missing_worktrees.push((worktree_id, directory_name.clone())); + missing_worktrees.push((worktree_id, directory_name)); let path = RelPath::empty().to_owned().into_arc(); let settings_ui_file = SettingsUiFile::Project((worktree_id, path)); diff --git a/crates/sidebar/src/sidebar.rs b/crates/sidebar/src/sidebar.rs index 60a0d4e5745..ac31eb563b8 100644 --- a/crates/sidebar/src/sidebar.rs +++ b/crates/sidebar/src/sidebar.rs @@ -2703,7 +2703,6 @@ impl Sidebar { { let this = this.clone(); let key = key.clone(); - let workspace = workspace.clone(); move |window, cx| { this.update(cx, |sidebar, cx| { sidebar.set_group_expanded(&key, true, cx); @@ -3061,13 +3060,12 @@ impl Sidebar { let activate_weak_menu = weak_menu.clone(); let close_weak_menu = weak_menu.clone(); let activate_workspace = workspace.clone(); - let close_workspace = workspace.clone(); menu = menu.custom_entry( move |_window, _cx| { let close_multi_workspace = close_multi_workspace.clone(); let close_weak_menu = close_weak_menu.clone(); - let close_workspace = close_workspace.clone(); + let close_workspace = workspace.clone(); let row_group_name = SharedString::from(format!( "workspace-menu-row-{workspace_index}" )); diff --git a/crates/text/src/tests.rs b/crates/text/src/tests.rs index f3851b15101..ff00f9b9647 100644 --- a/crates/text/src/tests.rs +++ b/crates/text/src/tests.rs @@ -295,7 +295,7 @@ fn test_random_edits(mut rng: StdRng) { subscription_edits, ); - let mut text = old_buffer.visible_text.clone(); + let mut text = old_buffer.visible_text; for edit in subscription_edits.into_inner() { let new_text: String = buffer.text_for_range(edit.new.clone()).collect(); text.replace(edit.new.start..edit.new.start + edit.old.len(), &new_text); diff --git a/crates/title_bar/src/title_bar.rs b/crates/title_bar/src/title_bar.rs index dceb1a5a489..ba50023f1bb 100644 --- a/crates/title_bar/src/title_bar.rs +++ b/crates/title_bar/src/title_bar.rs @@ -1379,7 +1379,6 @@ impl TitleBar { }, { let user_store = user_store.clone(); - let organization = organization.clone(); let workspace = workspace.clone(); move |window, cx| { let task = user_store.update(cx, |user_store, cx| { diff --git a/crates/vim/src/motion.rs b/crates/vim/src/motion.rs index 431edda7152..d1dac93fd23 100644 --- a/crates/vim/src/motion.rs +++ b/crates/vim/src/motion.rs @@ -11,7 +11,7 @@ use language::{CharKind, Point, Selection, SelectionGoal, TextObject, TreeSitter use multi_buffer::MultiBufferRow; use schemars::JsonSchema; use serde::Deserialize; -use std::{f64, ops::Range}; +use std::ops::Range; use workspace::searchable::Direction; diff --git a/crates/vim/src/normal/repeat.rs b/crates/vim/src/normal/repeat.rs index d1b79de4f57..e85614cbe74 100644 --- a/crates/vim/src/normal/repeat.rs +++ b/crates/vim/src/normal/repeat.rs @@ -27,10 +27,7 @@ actions!( fn should_replay(action: &dyn Action) -> bool { // skip so that we don't leave the character palette open - if editor::actions::ShowCharacterPalette.partial_eq(action) { - return false; - } - true + !editor::actions::ShowCharacterPalette.partial_eq(action) } fn repeatable_insert(action: &ReplayableAction) -> Option> { diff --git a/crates/vim/src/object.rs b/crates/vim/src/object.rs index e0f2b5e78cc..2b9560c8126 100644 --- a/crates/vim/src/object.rs +++ b/crates/vim/src/object.rs @@ -143,7 +143,7 @@ fn cover_or_next, Range = path.into(); - map.entry(path.clone()) - .or_default() - .push(SerializedBookmark { - row: bookmark.row, - label: bookmark.label, - }) + map.entry(path).or_default().push(SerializedBookmark { + row: bookmark.row, + label: bookmark.label, + }) } map diff --git a/crates/workspace/src/workspace.rs b/crates/workspace/src/workspace.rs index 6013611f6f9..a501378d6e7 100644 --- a/crates/workspace/src/workspace.rs +++ b/crates/workspace/src/workspace.rs @@ -3123,7 +3123,7 @@ impl Workspace { .insert(project_path.clone()); } - history.insert(project_path, (fs_path, std::usize::MAX)); + history.insert(project_path, (fs_path, usize::MAX)); } } diff --git a/crates/worktree/src/worktree.rs b/crates/worktree/src/worktree.rs index 785174ce14e..397c8fd2dbf 100644 --- a/crates/worktree/src/worktree.rs +++ b/crates/worktree/src/worktree.rs @@ -1526,7 +1526,7 @@ impl LocalWorktree { repository_dir_abs_path: Some( new_repo.repository_dir_abs_path.clone(), ), - common_dir_abs_path: Some(new_repo.common_dir_abs_path.clone()), + common_dir_abs_path: Some(new_repo.common_dir_abs_path), }); new_repos.next(); } @@ -1550,7 +1550,7 @@ impl LocalWorktree { changes.push(UpdatedGitRepository { work_directory_id: new_entry_id, old_work_directory_abs_path: Some( - old_repo.work_directory_abs_path.clone(), + old_repo.work_directory_abs_path, ), new_work_directory_abs_path: Some( new_repo.work_directory_abs_path.clone(), @@ -1559,7 +1559,7 @@ impl LocalWorktree { repository_dir_abs_path: Some( new_repo.repository_dir_abs_path.clone(), ), - common_dir_abs_path: Some(new_repo.common_dir_abs_path.clone()), + common_dir_abs_path: Some(new_repo.common_dir_abs_path), }); } new_repos.next(); @@ -1568,9 +1568,7 @@ impl LocalWorktree { Ordering::Greater => { changes.push(UpdatedGitRepository { work_directory_id: old_entry_id, - old_work_directory_abs_path: Some( - old_repo.work_directory_abs_path.clone(), - ), + old_work_directory_abs_path: Some(old_repo.work_directory_abs_path), new_work_directory_abs_path: None, dot_git_abs_path: None, repository_dir_abs_path: None, @@ -1587,7 +1585,7 @@ impl LocalWorktree { new_work_directory_abs_path: Some(repo.work_directory_abs_path.clone()), dot_git_abs_path: Some(repo.dot_git_abs_path.clone()), repository_dir_abs_path: Some(repo.repository_dir_abs_path.clone()), - common_dir_abs_path: Some(repo.common_dir_abs_path.clone()), + common_dir_abs_path: Some(repo.common_dir_abs_path), }); new_repos.next(); } @@ -1598,7 +1596,7 @@ impl LocalWorktree { new_work_directory_abs_path: None, dot_git_abs_path: Some(repo.dot_git_abs_path.clone()), repository_dir_abs_path: Some(repo.repository_dir_abs_path.clone()), - common_dir_abs_path: Some(repo.common_dir_abs_path.clone()), + common_dir_abs_path: Some(repo.common_dir_abs_path), }); old_repos.next(); } diff --git a/crates/worktree/tests/integration/worktree_tests.rs b/crates/worktree/tests/integration/worktree_tests.rs index 602eb8f75cc..6b97d3550b4 100644 --- a/crates/worktree/tests/integration/worktree_tests.rs +++ b/crates/worktree/tests/integration/worktree_tests.rs @@ -3851,17 +3851,15 @@ async fn test_random_worktree_operations_during_initial_scan( let settings = worktree.read_with(cx, |tree, _| tree.as_local().unwrap().settings()); - for (i, snapshot) in snapshots.into_iter().enumerate().rev() { - let mut updated_snapshot = snapshot.clone(); + for (i, mut snapshot) in snapshots.into_iter().enumerate().rev() { for update in updates.lock().iter() { - if update.scan_id >= updated_snapshot.scan_id() as u64 { - updated_snapshot - .apply_remote_update(update.clone(), &settings.file_scan_inclusions); + if update.scan_id >= snapshot.scan_id() as u64 { + snapshot.apply_remote_update(update.clone(), &settings.file_scan_inclusions); } } assert_eq!( - updated_snapshot.entries(true, 0).collect::>(), + snapshot.entries(true, 0).collect::>(), final_snapshot.entries(true, 0).collect::>(), "wrong updates after snapshot {i}: {updates:#?}", ); diff --git a/crates/zeta_prompt/src/hashed_regions.rs b/crates/zeta_prompt/src/hashed_regions.rs index 44c9ca8bab6..7b89a839ef8 100644 --- a/crates/zeta_prompt/src/hashed_regions.rs +++ b/crates/zeta_prompt/src/hashed_regions.rs @@ -799,9 +799,9 @@ fn assemble_patch_from_edits( && let Some(cursor_offset) = cursor_in_new_text { cursor = Some(HashRegionCursor { - path: path.clone(), + path, cursor_offset_in_new_text: cursor_offset, - new_text: new_text.clone(), + new_text, old_text: old_text.to_string(), start_row, }); diff --git a/crates/ztracing_macro/Cargo.toml b/crates/ztracing_macro/Cargo.toml index 78feebb8730..b85bbf2aa87 100644 --- a/crates/ztracing_macro/Cargo.toml +++ b/crates/ztracing_macro/Cargo.toml @@ -5,6 +5,9 @@ edition.workspace = true publish.workspace = true license = "Apache-2.0" +[lints] +workspace = true + [lib] proc-macro = true test = false