Fix clippy::redundant_clone
lint violations (#36558)
This removes around 900 unnecessary clones, ranging from cloning a few ints all the way to large data structures and images. A lot of these were fixed using `cargo clippy --fix --workspace --all-targets`, however it often breaks other lints and needs to be run again. This was then followed up with some manual fixing. I understand this is a large diff, but all the changes are pretty trivial. Rust is doing some heavy lifting here for us. Once I get it up to speed with main, I'd appreciate this getting merged rather sooner than later. Release Notes: - N/A
This commit is contained in:
parent
cf7c64d77f
commit
7bdc99abc1
306 changed files with 805 additions and 1102 deletions
|
@ -840,6 +840,7 @@ match_like_matches_macro = "warn"
|
|||
module_inception = { level = "deny" }
|
||||
question_mark = { level = "deny" }
|
||||
single_match = "warn"
|
||||
redundant_clone = "warn"
|
||||
redundant_closure = { level = "deny" }
|
||||
redundant_static_lifetimes = { level = "warn" }
|
||||
redundant_pattern_matching = "warn"
|
||||
|
|
|
@ -471,7 +471,7 @@ impl ContentBlock {
|
|||
|
||||
fn block_string_contents(&self, block: acp::ContentBlock) -> String {
|
||||
match block {
|
||||
acp::ContentBlock::Text(text_content) => text_content.text.clone(),
|
||||
acp::ContentBlock::Text(text_content) => text_content.text,
|
||||
acp::ContentBlock::ResourceLink(resource_link) => {
|
||||
Self::resource_link_md(&resource_link.uri)
|
||||
}
|
||||
|
@ -1020,7 +1020,7 @@ impl AcpThread {
|
|||
let location_updated = update.fields.locations.is_some();
|
||||
current_call.update_fields(update.fields, languages, cx);
|
||||
if location_updated {
|
||||
self.resolve_locations(update.id.clone(), cx);
|
||||
self.resolve_locations(update.id, cx);
|
||||
}
|
||||
}
|
||||
ToolCallUpdate::UpdateDiff(update) => {
|
||||
|
|
|
@ -222,7 +222,7 @@ impl PendingDiff {
|
|||
fn finalize(&self, cx: &mut Context<Diff>) -> FinalizedDiff {
|
||||
let ranges = self.excerpt_ranges(cx);
|
||||
let base_text = self.base_text.clone();
|
||||
let language_registry = self.buffer.read(cx).language_registry().clone();
|
||||
let language_registry = self.buffer.read(cx).language_registry();
|
||||
|
||||
let path = self
|
||||
.buffer
|
||||
|
@ -248,7 +248,6 @@ impl PendingDiff {
|
|||
|
||||
let buffer_diff = cx.spawn({
|
||||
let buffer = buffer.clone();
|
||||
let language_registry = language_registry.clone();
|
||||
async move |_this, cx| {
|
||||
build_buffer_diff(base_text, &buffer, language_registry, cx).await
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ impl ActionLog {
|
|||
diff_base,
|
||||
last_seen_base,
|
||||
unreviewed_edits,
|
||||
snapshot: text_snapshot.clone(),
|
||||
snapshot: text_snapshot,
|
||||
status,
|
||||
version: buffer.read(cx).version(),
|
||||
diff,
|
||||
|
@ -461,7 +461,7 @@ impl ActionLog {
|
|||
anyhow::Ok((
|
||||
tracked_buffer.diff.clone(),
|
||||
buffer.read(cx).language().cloned(),
|
||||
buffer.read(cx).language_registry().clone(),
|
||||
buffer.read(cx).language_registry(),
|
||||
))
|
||||
})??;
|
||||
let diff_snapshot = BufferDiff::update_diff(
|
||||
|
@ -529,12 +529,12 @@ impl ActionLog {
|
|||
|
||||
/// Mark a buffer as created by agent, so we can refresh it in the context
|
||||
pub fn buffer_created(&mut self, buffer: Entity<Buffer>, cx: &mut Context<Self>) {
|
||||
self.track_buffer_internal(buffer.clone(), true, cx);
|
||||
self.track_buffer_internal(buffer, true, cx);
|
||||
}
|
||||
|
||||
/// Mark a buffer as edited by agent, so we can refresh it in the context
|
||||
pub fn buffer_edited(&mut self, buffer: Entity<Buffer>, cx: &mut Context<Self>) {
|
||||
let tracked_buffer = self.track_buffer_internal(buffer.clone(), false, cx);
|
||||
let tracked_buffer = self.track_buffer_internal(buffer, false, cx);
|
||||
if let TrackedBufferStatus::Deleted = tracked_buffer.status {
|
||||
tracked_buffer.status = TrackedBufferStatus::Modified;
|
||||
}
|
||||
|
@ -2425,7 +2425,7 @@ mod tests {
|
|||
assert_eq!(
|
||||
unreviewed_hunks(&action_log, cx),
|
||||
vec![(
|
||||
buffer.clone(),
|
||||
buffer,
|
||||
vec![
|
||||
HunkStatus {
|
||||
range: Point::new(6, 0)..Point::new(7, 0),
|
||||
|
|
|
@ -132,7 +132,7 @@ mod tests {
|
|||
});
|
||||
let tool_set = default_tool_set(cx);
|
||||
|
||||
let profile = AgentProfile::new(id.clone(), tool_set);
|
||||
let profile = AgentProfile::new(id, tool_set);
|
||||
|
||||
let mut enabled_tools = cx
|
||||
.read(|cx| profile.enabled_tools(cx))
|
||||
|
@ -169,7 +169,7 @@ mod tests {
|
|||
});
|
||||
let tool_set = default_tool_set(cx);
|
||||
|
||||
let profile = AgentProfile::new(id.clone(), tool_set);
|
||||
let profile = AgentProfile::new(id, tool_set);
|
||||
|
||||
let mut enabled_tools = cx
|
||||
.read(|cx| profile.enabled_tools(cx))
|
||||
|
@ -202,7 +202,7 @@ mod tests {
|
|||
});
|
||||
let tool_set = default_tool_set(cx);
|
||||
|
||||
let profile = AgentProfile::new(id.clone(), tool_set);
|
||||
let profile = AgentProfile::new(id, tool_set);
|
||||
|
||||
let mut enabled_tools = cx
|
||||
.read(|cx| profile.enabled_tools(cx))
|
||||
|
|
|
@ -86,15 +86,13 @@ impl Tool for ContextServerTool {
|
|||
) -> ToolResult {
|
||||
if let Some(server) = self.store.read(cx).get_running_server(&self.server_id) {
|
||||
let tool_name = self.tool.name.clone();
|
||||
let server_clone = server.clone();
|
||||
let input_clone = input.clone();
|
||||
|
||||
cx.spawn(async move |_cx| {
|
||||
let Some(protocol) = server_clone.client() else {
|
||||
let Some(protocol) = server.client() else {
|
||||
bail!("Context server not initialized");
|
||||
};
|
||||
|
||||
let arguments = if let serde_json::Value::Object(map) = input_clone {
|
||||
let arguments = if let serde_json::Value::Object(map) = input {
|
||||
Some(map.into_iter().collect())
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -494,7 +494,7 @@ impl Thread {
|
|||
last_received_chunk_at: None,
|
||||
request_callback: None,
|
||||
remaining_turns: u32::MAX,
|
||||
configured_model: configured_model.clone(),
|
||||
configured_model,
|
||||
profile: AgentProfile::new(profile_id, tools),
|
||||
}
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ impl Thread {
|
|||
.and_then(|model| {
|
||||
let model = SelectedModel {
|
||||
provider: model.provider.clone().into(),
|
||||
model: model.model.clone().into(),
|
||||
model: model.model.into(),
|
||||
};
|
||||
registry.select_model(&model, cx)
|
||||
})
|
||||
|
@ -1646,10 +1646,10 @@ impl Thread {
|
|||
};
|
||||
|
||||
self.tool_use
|
||||
.request_tool_use(tool_message_id, tool_use, tool_use_metadata.clone(), cx);
|
||||
.request_tool_use(tool_message_id, tool_use, tool_use_metadata, cx);
|
||||
|
||||
self.tool_use.insert_tool_output(
|
||||
tool_use_id.clone(),
|
||||
tool_use_id,
|
||||
tool_name,
|
||||
tool_output,
|
||||
self.configured_model.as_ref(),
|
||||
|
@ -3241,7 +3241,7 @@ impl Thread {
|
|||
self.configured_model.as_ref(),
|
||||
self.completion_mode,
|
||||
);
|
||||
self.tool_finished(tool_use_id.clone(), None, true, window, cx);
|
||||
self.tool_finished(tool_use_id, None, true, window, cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3873,7 +3873,7 @@ fn main() {{
|
|||
AgentSettings {
|
||||
model_parameters: vec![LanguageModelParameters {
|
||||
provider: Some(model.provider_id().0.to_string().into()),
|
||||
model: Some(model.id().0.clone()),
|
||||
model: Some(model.id().0),
|
||||
temperature: Some(0.66),
|
||||
}],
|
||||
..AgentSettings::get_global(cx).clone()
|
||||
|
@ -3893,7 +3893,7 @@ fn main() {{
|
|||
AgentSettings {
|
||||
model_parameters: vec![LanguageModelParameters {
|
||||
provider: None,
|
||||
model: Some(model.id().0.clone()),
|
||||
model: Some(model.id().0),
|
||||
temperature: Some(0.66),
|
||||
}],
|
||||
..AgentSettings::get_global(cx).clone()
|
||||
|
@ -3933,7 +3933,7 @@ fn main() {{
|
|||
AgentSettings {
|
||||
model_parameters: vec![LanguageModelParameters {
|
||||
provider: Some("anthropic".into()),
|
||||
model: Some(model.id().0.clone()),
|
||||
model: Some(model.id().0),
|
||||
temperature: Some(0.66),
|
||||
}],
|
||||
..AgentSettings::get_global(cx).clone()
|
||||
|
|
|
@ -255,7 +255,7 @@ impl NativeAgent {
|
|||
}),
|
||||
cx.subscribe(&thread_handle, Self::handle_thread_token_usage_updated),
|
||||
cx.observe(&thread_handle, move |this, thread, cx| {
|
||||
this.save_thread(thread.clone(), cx)
|
||||
this.save_thread(thread, cx)
|
||||
}),
|
||||
];
|
||||
|
||||
|
@ -499,8 +499,8 @@ impl NativeAgent {
|
|||
self.models.refresh_list(cx);
|
||||
|
||||
let registry = LanguageModelRegistry::read_global(cx);
|
||||
let default_model = registry.default_model().map(|m| m.model.clone());
|
||||
let summarization_model = registry.thread_summary_model().map(|m| m.model.clone());
|
||||
let default_model = registry.default_model().map(|m| m.model);
|
||||
let summarization_model = registry.thread_summary_model().map(|m| m.model);
|
||||
|
||||
for session in self.sessions.values_mut() {
|
||||
session.thread.update(cx, |thread, cx| {
|
||||
|
|
|
@ -287,7 +287,7 @@ impl ThreadsDatabase {
|
|||
.map_err(|e| anyhow!("Failed to create threads table: {}", e))?;
|
||||
|
||||
let db = Self {
|
||||
executor: executor.clone(),
|
||||
executor,
|
||||
connection: Arc::new(Mutex::new(connection)),
|
||||
};
|
||||
|
||||
|
@ -325,7 +325,7 @@ impl ThreadsDatabase {
|
|||
INSERT OR REPLACE INTO threads (id, summary, updated_at, data_type, data) VALUES (?, ?, ?, ?, ?)
|
||||
"})?;
|
||||
|
||||
insert((id.0.clone(), title, updated_at, data_type, data))?;
|
||||
insert((id.0, title, updated_at, data_type, data))?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -434,7 +434,7 @@ mod tests {
|
|||
let client = Client::new(clock, http_client, cx);
|
||||
agent::init(cx);
|
||||
agent_settings::init(cx);
|
||||
language_model::init(client.clone(), cx);
|
||||
language_model::init(client, cx);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1401,7 +1401,7 @@ async fn test_agent_connection(cx: &mut TestAppContext) {
|
|||
let client = Client::new(clock, http_client, cx);
|
||||
let user_store = cx.new(|cx| UserStore::new(client.clone(), cx));
|
||||
language_model::init(client.clone(), cx);
|
||||
language_models::init(user_store.clone(), client.clone(), cx);
|
||||
language_models::init(user_store, client.clone(), cx);
|
||||
Project::init_settings(cx);
|
||||
LanguageModelRegistry::test(cx);
|
||||
agent_settings::init(cx);
|
||||
|
@ -1854,7 +1854,7 @@ async fn setup(cx: &mut TestAppContext, model: TestModel) -> ThreadTest {
|
|||
let client = Client::production(cx);
|
||||
let user_store = cx.new(|cx| UserStore::new(client.clone(), cx));
|
||||
language_model::init(client.clone(), cx);
|
||||
language_models::init(user_store.clone(), client.clone(), cx);
|
||||
language_models::init(user_store, client.clone(), cx);
|
||||
|
||||
watch_settings(fs.clone(), cx);
|
||||
});
|
||||
|
|
|
@ -679,7 +679,7 @@ impl Thread {
|
|||
.and_then(|model| {
|
||||
let model = SelectedModel {
|
||||
provider: model.provider.clone().into(),
|
||||
model: model.model.clone().into(),
|
||||
model: model.model.into(),
|
||||
};
|
||||
registry.select_model(&model, cx)
|
||||
})
|
||||
|
|
|
@ -176,15 +176,13 @@ impl AnyAgentTool for ContextServerTool {
|
|||
return Task::ready(Err(anyhow!("Context server not found")));
|
||||
};
|
||||
let tool_name = self.tool.name.clone();
|
||||
let server_clone = server.clone();
|
||||
let input_clone = input.clone();
|
||||
|
||||
cx.spawn(async move |_cx| {
|
||||
let Some(protocol) = server_clone.client() else {
|
||||
let Some(protocol) = server.client() else {
|
||||
bail!("Context server not initialized");
|
||||
};
|
||||
|
||||
let arguments = if let serde_json::Value::Object(map) = input_clone {
|
||||
let arguments = if let serde_json::Value::Object(map) = input {
|
||||
Some(map.into_iter().collect())
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -427,7 +427,7 @@ impl AgentTool for EditFileTool {
|
|||
|
||||
Ok(EditFileToolOutput {
|
||||
input_path: input.path,
|
||||
new_text: new_text.clone(),
|
||||
new_text,
|
||||
old_text,
|
||||
diff: unified_diff,
|
||||
edit_agent_output,
|
||||
|
|
|
@ -318,7 +318,7 @@ mod tests {
|
|||
init_test(cx);
|
||||
cx.executor().allow_parking();
|
||||
|
||||
let fs = FakeFs::new(cx.executor().clone());
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
fs.insert_tree(
|
||||
path!("/root"),
|
||||
serde_json::json!({
|
||||
|
@ -403,7 +403,7 @@ mod tests {
|
|||
init_test(cx);
|
||||
cx.executor().allow_parking();
|
||||
|
||||
let fs = FakeFs::new(cx.executor().clone());
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
fs.insert_tree(
|
||||
path!("/root"),
|
||||
serde_json::json!({
|
||||
|
@ -478,7 +478,7 @@ mod tests {
|
|||
init_test(cx);
|
||||
cx.executor().allow_parking();
|
||||
|
||||
let fs = FakeFs::new(cx.executor().clone());
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
|
||||
// Create test file with syntax structures
|
||||
fs.insert_tree(
|
||||
|
@ -763,7 +763,7 @@ mod tests {
|
|||
if cfg!(windows) {
|
||||
result.replace("root\\", "root/")
|
||||
} else {
|
||||
result.to_string()
|
||||
result
|
||||
}
|
||||
}
|
||||
Err(e) => panic!("Failed to run grep tool: {}", e),
|
||||
|
|
|
@ -234,7 +234,7 @@ fn process_content(
|
|||
if is_empty {
|
||||
"Command executed successfully.".to_string()
|
||||
} else {
|
||||
content.to_string()
|
||||
content
|
||||
}
|
||||
}
|
||||
Some(exit_status) => {
|
||||
|
|
|
@ -787,7 +787,7 @@ impl Content {
|
|||
pub fn chunks(self) -> impl Iterator<Item = ContentChunk> {
|
||||
match self {
|
||||
Self::Chunks(chunks) => chunks.into_iter(),
|
||||
Self::UntaggedText(text) => vec![ContentChunk::Text { text: text.clone() }].into_iter(),
|
||||
Self::UntaggedText(text) => vec![ContentChunk::Text { text }].into_iter(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ impl ClaudeTool {
|
|||
Self::Terminal(None)
|
||||
} else {
|
||||
Self::Other {
|
||||
name: tool_name.to_string(),
|
||||
name: tool_name,
|
||||
input,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ impl ContextPickerCompletionProvider {
|
|||
) -> Option<Completion> {
|
||||
match entry {
|
||||
ContextPickerEntry::Mode(mode) => Some(Completion {
|
||||
replace_range: source_range.clone(),
|
||||
replace_range: source_range,
|
||||
new_text: format!("@{} ", mode.keyword()),
|
||||
label: CodeLabel::plain(mode.label().to_string(), None),
|
||||
icon_path: Some(mode.icon().path().into()),
|
||||
|
@ -146,7 +146,7 @@ impl ContextPickerCompletionProvider {
|
|||
};
|
||||
|
||||
Some(Completion {
|
||||
replace_range: source_range.clone(),
|
||||
replace_range: source_range,
|
||||
new_text,
|
||||
label: CodeLabel::plain(action.label().to_string(), None),
|
||||
icon_path: Some(action.icon().path().into()),
|
||||
|
@ -187,7 +187,7 @@ impl ContextPickerCompletionProvider {
|
|||
documentation: None,
|
||||
insert_text_mode: None,
|
||||
source: project::CompletionSource::Custom,
|
||||
icon_path: Some(icon_for_completion.clone()),
|
||||
icon_path: Some(icon_for_completion),
|
||||
confirm: Some(confirm_completion_callback(
|
||||
thread_entry.title().clone(),
|
||||
source_range.start,
|
||||
|
@ -218,9 +218,9 @@ impl ContextPickerCompletionProvider {
|
|||
documentation: None,
|
||||
insert_text_mode: None,
|
||||
source: project::CompletionSource::Custom,
|
||||
icon_path: Some(icon_path.clone()),
|
||||
icon_path: Some(icon_path),
|
||||
confirm: Some(confirm_completion_callback(
|
||||
rule.title.clone(),
|
||||
rule.title,
|
||||
source_range.start,
|
||||
new_text_len - 1,
|
||||
editor,
|
||||
|
@ -260,7 +260,7 @@ impl ContextPickerCompletionProvider {
|
|||
let completion_icon_path = if is_recent {
|
||||
IconName::HistoryRerun.path().into()
|
||||
} else {
|
||||
crease_icon_path.clone()
|
||||
crease_icon_path
|
||||
};
|
||||
|
||||
let new_text = format!("{} ", uri.as_link());
|
||||
|
@ -309,10 +309,10 @@ impl ContextPickerCompletionProvider {
|
|||
label,
|
||||
documentation: None,
|
||||
source: project::CompletionSource::Custom,
|
||||
icon_path: Some(icon_path.clone()),
|
||||
icon_path: Some(icon_path),
|
||||
insert_text_mode: None,
|
||||
confirm: Some(confirm_completion_callback(
|
||||
symbol.name.clone().into(),
|
||||
symbol.name.into(),
|
||||
source_range.start,
|
||||
new_text_len - 1,
|
||||
message_editor,
|
||||
|
@ -327,7 +327,7 @@ impl ContextPickerCompletionProvider {
|
|||
message_editor: WeakEntity<MessageEditor>,
|
||||
cx: &mut App,
|
||||
) -> Option<Completion> {
|
||||
let new_text = format!("@fetch {} ", url_to_fetch.clone());
|
||||
let new_text = format!("@fetch {} ", url_to_fetch);
|
||||
let url_to_fetch = url::Url::parse(url_to_fetch.as_ref())
|
||||
.or_else(|_| url::Url::parse(&format!("https://{url_to_fetch}")))
|
||||
.ok()?;
|
||||
|
@ -341,7 +341,7 @@ impl ContextPickerCompletionProvider {
|
|||
label: CodeLabel::plain(url_to_fetch.to_string(), None),
|
||||
documentation: None,
|
||||
source: project::CompletionSource::Custom,
|
||||
icon_path: Some(icon_path.clone()),
|
||||
icon_path: Some(icon_path),
|
||||
insert_text_mode: None,
|
||||
confirm: Some(confirm_completion_callback(
|
||||
url_to_fetch.to_string().into(),
|
||||
|
@ -365,8 +365,7 @@ impl ContextPickerCompletionProvider {
|
|||
};
|
||||
match mode {
|
||||
Some(ContextPickerMode::File) => {
|
||||
let search_files_task =
|
||||
search_files(query.clone(), cancellation_flag.clone(), &workspace, cx);
|
||||
let search_files_task = search_files(query, cancellation_flag, &workspace, cx);
|
||||
cx.background_spawn(async move {
|
||||
search_files_task
|
||||
.await
|
||||
|
@ -377,8 +376,7 @@ impl ContextPickerCompletionProvider {
|
|||
}
|
||||
|
||||
Some(ContextPickerMode::Symbol) => {
|
||||
let search_symbols_task =
|
||||
search_symbols(query.clone(), cancellation_flag.clone(), &workspace, cx);
|
||||
let search_symbols_task = search_symbols(query, cancellation_flag, &workspace, cx);
|
||||
cx.background_spawn(async move {
|
||||
search_symbols_task
|
||||
.await
|
||||
|
@ -389,12 +387,8 @@ impl ContextPickerCompletionProvider {
|
|||
}
|
||||
|
||||
Some(ContextPickerMode::Thread) => {
|
||||
let search_threads_task = search_threads(
|
||||
query.clone(),
|
||||
cancellation_flag.clone(),
|
||||
&self.history_store,
|
||||
cx,
|
||||
);
|
||||
let search_threads_task =
|
||||
search_threads(query, cancellation_flag, &self.history_store, cx);
|
||||
cx.background_spawn(async move {
|
||||
search_threads_task
|
||||
.await
|
||||
|
@ -415,7 +409,7 @@ impl ContextPickerCompletionProvider {
|
|||
Some(ContextPickerMode::Rules) => {
|
||||
if let Some(prompt_store) = self.prompt_store.as_ref() {
|
||||
let search_rules_task =
|
||||
search_rules(query.clone(), cancellation_flag.clone(), prompt_store, cx);
|
||||
search_rules(query, cancellation_flag, prompt_store, cx);
|
||||
cx.background_spawn(async move {
|
||||
search_rules_task
|
||||
.await
|
||||
|
@ -448,7 +442,7 @@ impl ContextPickerCompletionProvider {
|
|||
let executor = cx.background_executor().clone();
|
||||
|
||||
let search_files_task =
|
||||
search_files(query.clone(), cancellation_flag.clone(), &workspace, cx);
|
||||
search_files(query.clone(), cancellation_flag, &workspace, cx);
|
||||
|
||||
let entries = self.available_context_picker_entries(&workspace, cx);
|
||||
let entry_candidates = entries
|
||||
|
|
|
@ -260,7 +260,7 @@ impl MessageEditor {
|
|||
*excerpt_id,
|
||||
start,
|
||||
content_len,
|
||||
crease_text.clone(),
|
||||
crease_text,
|
||||
mention_uri.icon_path(cx),
|
||||
self.editor.clone(),
|
||||
window,
|
||||
|
@ -883,7 +883,7 @@ impl MessageEditor {
|
|||
.spawn_in(window, {
|
||||
let abs_path = abs_path.clone();
|
||||
async move |_, cx| {
|
||||
let image = image.await.map_err(|e| e.to_string())?;
|
||||
let image = image.await?;
|
||||
let format = image.format;
|
||||
let image = cx
|
||||
.update(|_, cx| LanguageModelImage::from_image(image, cx))
|
||||
|
@ -1231,7 +1231,6 @@ fn render_image_fold_icon_button(
|
|||
editor: WeakEntity<Editor>,
|
||||
) -> Arc<dyn Send + Sync + Fn(FoldId, Range<Anchor>, &mut App) -> AnyElement> {
|
||||
Arc::new({
|
||||
let image_task = image_task.clone();
|
||||
move |fold_id, fold_range, cx| {
|
||||
let is_in_text_selection = editor
|
||||
.update(cx, |editor, cx| editor.is_range_selected(&fold_range, cx))
|
||||
|
@ -1408,10 +1407,7 @@ impl MentionSet {
|
|||
crease_id,
|
||||
Mention::Text {
|
||||
uri,
|
||||
content: content
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!("{e}"))?
|
||||
.to_string(),
|
||||
content: content.await.map_err(|e| anyhow::anyhow!("{e}"))?,
|
||||
},
|
||||
))
|
||||
})
|
||||
|
@ -1478,10 +1474,7 @@ impl MentionSet {
|
|||
crease_id,
|
||||
Mention::Text {
|
||||
uri,
|
||||
content: content
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!("{e}"))?
|
||||
.to_string(),
|
||||
content: content.await.map_err(|e| anyhow::anyhow!("{e}"))?,
|
||||
},
|
||||
))
|
||||
})
|
||||
|
@ -1821,7 +1814,7 @@ mod tests {
|
|||
|
||||
impl Focusable for MessageEditorItem {
|
||||
fn focus_handle(&self, cx: &App) -> FocusHandle {
|
||||
self.0.read(cx).focus_handle(cx).clone()
|
||||
self.0.read(cx).focus_handle(cx)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2219,7 +2212,7 @@ mod tests {
|
|||
let completions = editor.current_completions().expect("Missing completions");
|
||||
completions
|
||||
.into_iter()
|
||||
.map(|completion| completion.label.text.to_string())
|
||||
.map(|completion| completion.label.text)
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1534,7 +1534,7 @@ impl AcpThreadView {
|
|||
window: &Window,
|
||||
cx: &Context<Self>,
|
||||
) -> AnyElement {
|
||||
let button_id = SharedString::from(format!("tool_output-{:?}", tool_call_id.clone()));
|
||||
let button_id = SharedString::from(format!("tool_output-{:?}", tool_call_id));
|
||||
|
||||
v_flex()
|
||||
.mt_1p5()
|
||||
|
@ -1555,9 +1555,8 @@ impl AcpThreadView {
|
|||
.icon_color(Color::Muted)
|
||||
.icon_position(IconPosition::Start)
|
||||
.on_click(cx.listener({
|
||||
let id = tool_call_id.clone();
|
||||
move |this: &mut Self, _, _, cx: &mut Context<Self>| {
|
||||
this.expanded_tool_calls.remove(&id);
|
||||
this.expanded_tool_calls.remove(&tool_call_id);
|
||||
cx.notify();
|
||||
}
|
||||
})),
|
||||
|
@ -1578,7 +1577,7 @@ impl AcpThreadView {
|
|||
uri.clone()
|
||||
};
|
||||
|
||||
let button_id = SharedString::from(format!("item-{}", uri.clone()));
|
||||
let button_id = SharedString::from(format!("item-{}", uri));
|
||||
|
||||
div()
|
||||
.ml(px(7.))
|
||||
|
@ -1724,7 +1723,7 @@ impl AcpThreadView {
|
|||
&& let Some(editor) = entry.editor_for_diff(diff)
|
||||
&& diff.read(cx).has_revealed_range(cx)
|
||||
{
|
||||
editor.clone().into_any_element()
|
||||
editor.into_any_element()
|
||||
} else if tool_progress {
|
||||
self.render_diff_loading(cx)
|
||||
} else {
|
||||
|
@ -2888,7 +2887,6 @@ impl AcpThreadView {
|
|||
.icon_size(IconSize::Small)
|
||||
.icon_color(Color::Muted)
|
||||
.tooltip({
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |window, cx| {
|
||||
Tooltip::for_action_in(
|
||||
expand_tooltip,
|
||||
|
@ -4372,7 +4370,7 @@ pub(crate) mod tests {
|
|||
|
||||
impl Focusable for ThreadViewItem {
|
||||
fn focus_handle(&self, cx: &App) -> FocusHandle {
|
||||
self.0.read(cx).focus_handle(cx).clone()
|
||||
self.0.read(cx).focus_handle(cx)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ fn render_markdown_code_block(
|
|||
.on_click({
|
||||
let active_thread = active_thread.clone();
|
||||
let parsed_markdown = parsed_markdown.clone();
|
||||
let code_block_range = metadata.content_range.clone();
|
||||
let code_block_range = metadata.content_range;
|
||||
move |_event, _window, cx| {
|
||||
active_thread.update(cx, |this, cx| {
|
||||
this.copied_code_block_ids.insert((message_id, ix));
|
||||
|
@ -532,7 +532,6 @@ fn render_markdown_code_block(
|
|||
"Expand Code"
|
||||
}))
|
||||
.on_click({
|
||||
let active_thread = active_thread.clone();
|
||||
move |_event, _window, cx| {
|
||||
active_thread.update(cx, |this, cx| {
|
||||
this.toggle_codeblock_expanded(message_id, ix);
|
||||
|
@ -916,7 +915,7 @@ impl ActiveThread {
|
|||
) {
|
||||
let rendered = self
|
||||
.rendered_tool_uses
|
||||
.entry(tool_use_id.clone())
|
||||
.entry(tool_use_id)
|
||||
.or_insert_with(|| RenderedToolUse {
|
||||
label: cx.new(|cx| {
|
||||
Markdown::new("".into(), Some(self.language_registry.clone()), None, cx)
|
||||
|
@ -1218,7 +1217,7 @@ impl ActiveThread {
|
|||
match AgentSettings::get_global(cx).notify_when_agent_waiting {
|
||||
NotifyWhenAgentWaiting::PrimaryScreen => {
|
||||
if let Some(primary) = cx.primary_display() {
|
||||
self.pop_up(icon, caption.into(), title.clone(), window, primary, cx);
|
||||
self.pop_up(icon, caption.into(), title, window, primary, cx);
|
||||
}
|
||||
}
|
||||
NotifyWhenAgentWaiting::AllScreens => {
|
||||
|
@ -2112,7 +2111,7 @@ impl ActiveThread {
|
|||
.gap_1()
|
||||
.children(message_content)
|
||||
.when_some(editing_message_state, |this, state| {
|
||||
let focus_handle = state.editor.focus_handle(cx).clone();
|
||||
let focus_handle = state.editor.focus_handle(cx);
|
||||
|
||||
this.child(
|
||||
h_flex()
|
||||
|
@ -2173,7 +2172,6 @@ impl ActiveThread {
|
|||
.icon_color(Color::Muted)
|
||||
.icon_size(IconSize::Small)
|
||||
.tooltip({
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |window, cx| {
|
||||
Tooltip::for_action_in(
|
||||
"Regenerate",
|
||||
|
@ -2312,7 +2310,7 @@ impl ActiveThread {
|
|||
.into_any_element()
|
||||
} else if let Some(error) = error {
|
||||
restore_checkpoint_button
|
||||
.tooltip(Tooltip::text(error.to_string()))
|
||||
.tooltip(Tooltip::text(error))
|
||||
.into_any_element()
|
||||
} else {
|
||||
restore_checkpoint_button.into_any_element()
|
||||
|
|
|
@ -165,8 +165,8 @@ impl AgentConfiguration {
|
|||
provider: &Arc<dyn LanguageModelProvider>,
|
||||
cx: &mut Context<Self>,
|
||||
) -> impl IntoElement + use<> {
|
||||
let provider_id = provider.id().0.clone();
|
||||
let provider_name = provider.name().0.clone();
|
||||
let provider_id = provider.id().0;
|
||||
let provider_name = provider.name().0;
|
||||
let provider_id_string = SharedString::from(format!("provider-disclosure-{provider_id}"));
|
||||
|
||||
let configuration_view = self
|
||||
|
@ -269,7 +269,7 @@ impl AgentConfiguration {
|
|||
.closed_icon(IconName::ChevronDown),
|
||||
)
|
||||
.on_click(cx.listener({
|
||||
let provider_id = provider.id().clone();
|
||||
let provider_id = provider.id();
|
||||
move |this, _event, _window, _cx| {
|
||||
let is_expanded = this
|
||||
.expanded_provider_configurations
|
||||
|
@ -665,7 +665,7 @@ impl AgentConfiguration {
|
|||
.size(IconSize::XSmall)
|
||||
.color(Color::Accent)
|
||||
.with_animation(
|
||||
SharedString::from(format!("{}-starting", context_server_id.0.clone(),)),
|
||||
SharedString::from(format!("{}-starting", context_server_id.0,)),
|
||||
Animation::new(Duration::from_secs(3)).repeat(),
|
||||
|icon, delta| icon.transform(Transformation::rotate(percentage(delta))),
|
||||
)
|
||||
|
@ -865,7 +865,6 @@ impl AgentConfiguration {
|
|||
.on_click({
|
||||
let context_server_manager =
|
||||
self.context_server_store.clone();
|
||||
let context_server_id = context_server_id.clone();
|
||||
let fs = self.fs.clone();
|
||||
|
||||
move |state, _window, cx| {
|
||||
|
@ -1075,7 +1074,6 @@ fn show_unable_to_uninstall_extension_with_context_server(
|
|||
cx,
|
||||
move |this, _cx| {
|
||||
let workspace_handle = workspace_handle.clone();
|
||||
let context_server_id = context_server_id.clone();
|
||||
|
||||
this.icon(ToastIcon::new(IconName::Warning).color(Color::Warning))
|
||||
.dismiss_button(true)
|
||||
|
|
|
@ -261,7 +261,6 @@ impl ConfigureContextServerModal {
|
|||
_cx: &mut Context<Workspace>,
|
||||
) {
|
||||
workspace.register_action({
|
||||
let language_registry = language_registry.clone();
|
||||
move |_workspace, _: &AddContextServer, window, cx| {
|
||||
let workspace_handle = cx.weak_entity();
|
||||
let language_registry = language_registry.clone();
|
||||
|
|
|
@ -464,7 +464,7 @@ impl ManageProfilesModal {
|
|||
},
|
||||
))
|
||||
.child(ListSeparator)
|
||||
.child(h_flex().p_2().child(mode.name_editor.clone()))
|
||||
.child(h_flex().p_2().child(mode.name_editor))
|
||||
}
|
||||
|
||||
fn render_view_profile(
|
||||
|
|
|
@ -185,7 +185,7 @@ impl AgentDiffPane {
|
|||
let focus_handle = cx.focus_handle();
|
||||
let multibuffer = cx.new(|_| MultiBuffer::new(Capability::ReadWrite));
|
||||
|
||||
let project = thread.project(cx).clone();
|
||||
let project = thread.project(cx);
|
||||
let editor = cx.new(|cx| {
|
||||
let mut editor =
|
||||
Editor::for_multibuffer(multibuffer.clone(), Some(project.clone()), window, cx);
|
||||
|
@ -196,7 +196,7 @@ impl AgentDiffPane {
|
|||
editor
|
||||
});
|
||||
|
||||
let action_log = thread.action_log(cx).clone();
|
||||
let action_log = thread.action_log(cx);
|
||||
|
||||
let mut this = Self {
|
||||
_subscriptions: vec![
|
||||
|
@ -1312,7 +1312,7 @@ impl AgentDiff {
|
|||
let entity = cx.new(|_cx| Self::default());
|
||||
let global = AgentDiffGlobal(entity.clone());
|
||||
cx.set_global(global);
|
||||
entity.clone()
|
||||
entity
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ impl AgentDiff {
|
|||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let action_log = thread.action_log(cx).clone();
|
||||
let action_log = thread.action_log(cx);
|
||||
|
||||
let action_log_subscription = cx.observe_in(&action_log, window, {
|
||||
let workspace = workspace.clone();
|
||||
|
@ -1544,7 +1544,7 @@ impl AgentDiff {
|
|||
&& let Some(editor) = item.downcast::<Editor>()
|
||||
&& let Some(buffer) = Self::full_editor_buffer(editor.read(cx), cx)
|
||||
{
|
||||
self.register_editor(workspace.downgrade(), buffer.clone(), editor, window, cx);
|
||||
self.register_editor(workspace.downgrade(), buffer, editor, window, cx);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,10 +66,8 @@ impl AgentModelSelector {
|
|||
fs.clone(),
|
||||
cx,
|
||||
move |settings, _cx| {
|
||||
settings.set_inline_assistant_model(
|
||||
provider.clone(),
|
||||
model_id.clone(),
|
||||
);
|
||||
settings
|
||||
.set_inline_assistant_model(provider.clone(), model_id);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -956,7 +956,7 @@ impl AgentPanel {
|
|||
|
||||
message_editor.focus_handle(cx).focus(window);
|
||||
|
||||
let thread_view = ActiveView::thread(active_thread.clone(), message_editor, window, cx);
|
||||
let thread_view = ActiveView::thread(active_thread, message_editor, window, cx);
|
||||
self.set_active_view(thread_view, window, cx);
|
||||
|
||||
AgentDiff::set_active_thread(&self.workspace, thread.clone(), window, cx);
|
||||
|
@ -1163,7 +1163,7 @@ impl AgentPanel {
|
|||
});
|
||||
self.set_active_view(
|
||||
ActiveView::prompt_editor(
|
||||
editor.clone(),
|
||||
editor,
|
||||
self.history_store.clone(),
|
||||
self.acp_history_store.clone(),
|
||||
self.language_registry.clone(),
|
||||
|
@ -1236,7 +1236,7 @@ impl AgentPanel {
|
|||
});
|
||||
message_editor.focus_handle(cx).focus(window);
|
||||
|
||||
let thread_view = ActiveView::thread(active_thread.clone(), message_editor, window, cx);
|
||||
let thread_view = ActiveView::thread(active_thread, message_editor, window, cx);
|
||||
self.set_active_view(thread_view, window, cx);
|
||||
AgentDiff::set_active_thread(&self.workspace, thread.clone(), window, cx);
|
||||
}
|
||||
|
@ -1525,7 +1525,7 @@ impl AgentPanel {
|
|||
return;
|
||||
}
|
||||
|
||||
let model = thread_state.configured_model().map(|cm| cm.model.clone());
|
||||
let model = thread_state.configured_model().map(|cm| cm.model);
|
||||
if let Some(model) = model {
|
||||
thread.update(cx, |active_thread, cx| {
|
||||
active_thread.thread().update(cx, |thread, cx| {
|
||||
|
@ -1680,7 +1680,7 @@ impl AgentPanel {
|
|||
.open_thread_by_id(&id, window, cx)
|
||||
.detach_and_log_err(cx),
|
||||
HistoryEntryId::Context(path) => this
|
||||
.open_saved_prompt_editor(path.clone(), window, cx)
|
||||
.open_saved_prompt_editor(path, window, cx)
|
||||
.detach_and_log_err(cx),
|
||||
})
|
||||
.ok();
|
||||
|
@ -1966,7 +1966,7 @@ impl AgentPanel {
|
|||
};
|
||||
|
||||
match state {
|
||||
ThreadSummary::Pending => Label::new(ThreadSummary::DEFAULT.clone())
|
||||
ThreadSummary::Pending => Label::new(ThreadSummary::DEFAULT)
|
||||
.truncate()
|
||||
.into_any_element(),
|
||||
ThreadSummary::Generating => Label::new(LOADING_SUMMARY_PLACEHOLDER)
|
||||
|
@ -2106,7 +2106,6 @@ impl AgentPanel {
|
|||
.anchor(Corner::TopRight)
|
||||
.with_handle(self.agent_panel_menu_handle.clone())
|
||||
.menu({
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |window, cx| {
|
||||
Some(ContextMenu::build(window, cx, |mut menu, _window, _| {
|
||||
menu = menu.context(focus_handle.clone());
|
||||
|
@ -2184,7 +2183,6 @@ impl AgentPanel {
|
|||
.trigger_with_tooltip(
|
||||
IconButton::new("agent-nav-menu", icon).icon_size(IconSize::Small),
|
||||
{
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |window, cx| {
|
||||
Tooltip::for_action_in(
|
||||
"Toggle Recent Threads",
|
||||
|
@ -2222,8 +2220,6 @@ impl AgentPanel {
|
|||
this.go_back(&workspace::GoBack, window, cx);
|
||||
}))
|
||||
.tooltip({
|
||||
let focus_handle = focus_handle.clone();
|
||||
|
||||
move |window, cx| {
|
||||
Tooltip::for_action_in("Go Back", &workspace::GoBack, &focus_handle, window, cx)
|
||||
}
|
||||
|
@ -2249,7 +2245,6 @@ impl AgentPanel {
|
|||
.anchor(Corner::TopRight)
|
||||
.with_handle(self.new_thread_menu_handle.clone())
|
||||
.menu({
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |window, cx| {
|
||||
let active_thread = active_thread.clone();
|
||||
Some(ContextMenu::build(window, cx, |mut menu, _window, cx| {
|
||||
|
@ -2377,7 +2372,6 @@ impl AgentPanel {
|
|||
.anchor(Corner::TopLeft)
|
||||
.with_handle(self.new_thread_menu_handle.clone())
|
||||
.menu({
|
||||
let focus_handle = focus_handle.clone();
|
||||
let workspace = self.workspace.clone();
|
||||
|
||||
move |window, cx| {
|
||||
|
@ -3015,7 +3009,7 @@ impl AgentPanel {
|
|||
// TODO: Add keyboard navigation.
|
||||
let is_hovered =
|
||||
self.hovered_recent_history_item == Some(index);
|
||||
HistoryEntryElement::new(entry.clone(), cx.entity().downgrade())
|
||||
HistoryEntryElement::new(entry, cx.entity().downgrade())
|
||||
.hovered(is_hovered)
|
||||
.on_hover(cx.listener(
|
||||
move |this, is_hovered, _window, cx| {
|
||||
|
@ -3339,7 +3333,7 @@ impl AgentPanel {
|
|||
.severity(Severity::Error)
|
||||
.icon(IconName::XCircle)
|
||||
.title(header)
|
||||
.description(message.clone())
|
||||
.description(message)
|
||||
.actions_slot(
|
||||
h_flex()
|
||||
.gap_0p5()
|
||||
|
@ -3359,7 +3353,7 @@ impl AgentPanel {
|
|||
Callout::new()
|
||||
.severity(Severity::Error)
|
||||
.title("Error")
|
||||
.description(message.clone())
|
||||
.description(message)
|
||||
.actions_slot(
|
||||
h_flex()
|
||||
.gap_0p5()
|
||||
|
|
|
@ -240,12 +240,7 @@ pub fn init(
|
|||
client.telemetry().clone(),
|
||||
cx,
|
||||
);
|
||||
terminal_inline_assistant::init(
|
||||
fs.clone(),
|
||||
prompt_builder.clone(),
|
||||
client.telemetry().clone(),
|
||||
cx,
|
||||
);
|
||||
terminal_inline_assistant::init(fs.clone(), prompt_builder, client.telemetry().clone(), cx);
|
||||
cx.observe_new(move |workspace, window, cx| {
|
||||
ConfigureContextServerModal::register(workspace, language_registry.clone(), window, cx)
|
||||
})
|
||||
|
@ -391,7 +386,6 @@ fn register_slash_commands(cx: &mut App) {
|
|||
slash_command_registry.register_command(assistant_slash_commands::FetchSlashCommand, true);
|
||||
|
||||
cx.observe_flag::<assistant_slash_commands::StreamingExampleSlashCommandFeatureFlag, _>({
|
||||
let slash_command_registry = slash_command_registry.clone();
|
||||
move |is_enabled, _cx| {
|
||||
if is_enabled {
|
||||
slash_command_registry.register_command(
|
||||
|
|
|
@ -1129,7 +1129,7 @@ mod tests {
|
|||
)
|
||||
});
|
||||
|
||||
let chunks_tx = simulate_response_stream(codegen.clone(), cx);
|
||||
let chunks_tx = simulate_response_stream(&codegen, cx);
|
||||
|
||||
let mut new_text = concat!(
|
||||
" let mut x = 0;\n",
|
||||
|
@ -1196,7 +1196,7 @@ mod tests {
|
|||
)
|
||||
});
|
||||
|
||||
let chunks_tx = simulate_response_stream(codegen.clone(), cx);
|
||||
let chunks_tx = simulate_response_stream(&codegen, cx);
|
||||
|
||||
cx.background_executor.run_until_parked();
|
||||
|
||||
|
@ -1265,7 +1265,7 @@ mod tests {
|
|||
)
|
||||
});
|
||||
|
||||
let chunks_tx = simulate_response_stream(codegen.clone(), cx);
|
||||
let chunks_tx = simulate_response_stream(&codegen, cx);
|
||||
|
||||
cx.background_executor.run_until_parked();
|
||||
|
||||
|
@ -1334,7 +1334,7 @@ mod tests {
|
|||
)
|
||||
});
|
||||
|
||||
let chunks_tx = simulate_response_stream(codegen.clone(), cx);
|
||||
let chunks_tx = simulate_response_stream(&codegen, cx);
|
||||
let new_text = concat!(
|
||||
"func main() {\n",
|
||||
"\tx := 0\n",
|
||||
|
@ -1391,7 +1391,7 @@ mod tests {
|
|||
)
|
||||
});
|
||||
|
||||
let chunks_tx = simulate_response_stream(codegen.clone(), cx);
|
||||
let chunks_tx = simulate_response_stream(&codegen, cx);
|
||||
chunks_tx
|
||||
.unbounded_send("let mut x = 0;\nx += 1;".to_string())
|
||||
.unwrap();
|
||||
|
@ -1473,7 +1473,7 @@ mod tests {
|
|||
}
|
||||
|
||||
fn simulate_response_stream(
|
||||
codegen: Entity<CodegenAlternative>,
|
||||
codegen: &Entity<CodegenAlternative>,
|
||||
cx: &mut TestAppContext,
|
||||
) -> mpsc::UnboundedSender<String> {
|
||||
let (chunks_tx, chunks_rx) = mpsc::unbounded();
|
||||
|
|
|
@ -818,13 +818,8 @@ pub fn crease_for_mention(
|
|||
|
||||
let render_trailer = move |_row, _unfold, _window: &mut Window, _cx: &mut App| Empty.into_any();
|
||||
|
||||
Crease::inline(
|
||||
range,
|
||||
placeholder.clone(),
|
||||
fold_toggle("mention"),
|
||||
render_trailer,
|
||||
)
|
||||
.with_metadata(CreaseMetadata { icon_path, label })
|
||||
Crease::inline(range, placeholder, fold_toggle("mention"), render_trailer)
|
||||
.with_metadata(CreaseMetadata { icon_path, label })
|
||||
}
|
||||
|
||||
fn render_fold_icon_button(
|
||||
|
|
|
@ -79,8 +79,7 @@ fn search(
|
|||
) -> Task<Vec<Match>> {
|
||||
match mode {
|
||||
Some(ContextPickerMode::File) => {
|
||||
let search_files_task =
|
||||
search_files(query.clone(), cancellation_flag.clone(), &workspace, cx);
|
||||
let search_files_task = search_files(query, cancellation_flag, &workspace, cx);
|
||||
cx.background_spawn(async move {
|
||||
search_files_task
|
||||
.await
|
||||
|
@ -91,8 +90,7 @@ fn search(
|
|||
}
|
||||
|
||||
Some(ContextPickerMode::Symbol) => {
|
||||
let search_symbols_task =
|
||||
search_symbols(query.clone(), cancellation_flag.clone(), &workspace, cx);
|
||||
let search_symbols_task = search_symbols(query, cancellation_flag, &workspace, cx);
|
||||
cx.background_spawn(async move {
|
||||
search_symbols_task
|
||||
.await
|
||||
|
@ -108,13 +106,8 @@ fn search(
|
|||
.and_then(|t| t.upgrade())
|
||||
.zip(text_thread_context_store.as_ref().and_then(|t| t.upgrade()))
|
||||
{
|
||||
let search_threads_task = search_threads(
|
||||
query.clone(),
|
||||
cancellation_flag.clone(),
|
||||
thread_store,
|
||||
context_store,
|
||||
cx,
|
||||
);
|
||||
let search_threads_task =
|
||||
search_threads(query, cancellation_flag, thread_store, context_store, cx);
|
||||
cx.background_spawn(async move {
|
||||
search_threads_task
|
||||
.await
|
||||
|
@ -137,8 +130,7 @@ fn search(
|
|||
|
||||
Some(ContextPickerMode::Rules) => {
|
||||
if let Some(prompt_store) = prompt_store.as_ref() {
|
||||
let search_rules_task =
|
||||
search_rules(query.clone(), cancellation_flag.clone(), prompt_store, cx);
|
||||
let search_rules_task = search_rules(query, cancellation_flag, prompt_store, cx);
|
||||
cx.background_spawn(async move {
|
||||
search_rules_task
|
||||
.await
|
||||
|
@ -196,7 +188,7 @@ fn search(
|
|||
let executor = cx.background_executor().clone();
|
||||
|
||||
let search_files_task =
|
||||
search_files(query.clone(), cancellation_flag.clone(), &workspace, cx);
|
||||
search_files(query.clone(), cancellation_flag, &workspace, cx);
|
||||
|
||||
let entries =
|
||||
available_context_picker_entries(&prompt_store, &thread_store, &workspace, cx);
|
||||
|
@ -283,7 +275,7 @@ impl ContextPickerCompletionProvider {
|
|||
) -> Option<Completion> {
|
||||
match entry {
|
||||
ContextPickerEntry::Mode(mode) => Some(Completion {
|
||||
replace_range: source_range.clone(),
|
||||
replace_range: source_range,
|
||||
new_text: format!("@{} ", mode.keyword()),
|
||||
label: CodeLabel::plain(mode.label().to_string(), None),
|
||||
icon_path: Some(mode.icon().path().into()),
|
||||
|
@ -330,9 +322,6 @@ impl ContextPickerCompletionProvider {
|
|||
);
|
||||
|
||||
let callback = Arc::new({
|
||||
let context_store = context_store.clone();
|
||||
let selections = selections.clone();
|
||||
let selection_infos = selection_infos.clone();
|
||||
move |_, window: &mut Window, cx: &mut App| {
|
||||
context_store.update(cx, |context_store, cx| {
|
||||
for (buffer, range) in &selections {
|
||||
|
@ -441,7 +430,7 @@ impl ContextPickerCompletionProvider {
|
|||
excerpt_id,
|
||||
source_range.start,
|
||||
new_text_len - 1,
|
||||
editor.clone(),
|
||||
editor,
|
||||
context_store.clone(),
|
||||
move |window, cx| match &thread_entry {
|
||||
ThreadContextEntry::Thread { id, .. } => {
|
||||
|
@ -510,7 +499,7 @@ impl ContextPickerCompletionProvider {
|
|||
excerpt_id,
|
||||
source_range.start,
|
||||
new_text_len - 1,
|
||||
editor.clone(),
|
||||
editor,
|
||||
context_store.clone(),
|
||||
move |_, cx| {
|
||||
let user_prompt_id = rules.prompt_id;
|
||||
|
@ -547,7 +536,7 @@ impl ContextPickerCompletionProvider {
|
|||
excerpt_id,
|
||||
source_range.start,
|
||||
new_text_len - 1,
|
||||
editor.clone(),
|
||||
editor,
|
||||
context_store.clone(),
|
||||
move |_, cx| {
|
||||
let context_store = context_store.clone();
|
||||
|
@ -704,16 +693,16 @@ impl ContextPickerCompletionProvider {
|
|||
excerpt_id,
|
||||
source_range.start,
|
||||
new_text_len - 1,
|
||||
editor.clone(),
|
||||
editor,
|
||||
context_store.clone(),
|
||||
move |_, cx| {
|
||||
let symbol = symbol.clone();
|
||||
let context_store = context_store.clone();
|
||||
let workspace = workspace.clone();
|
||||
let result = super::symbol_context_picker::add_symbol(
|
||||
symbol.clone(),
|
||||
symbol,
|
||||
false,
|
||||
workspace.clone(),
|
||||
workspace,
|
||||
context_store.downgrade(),
|
||||
cx,
|
||||
);
|
||||
|
@ -1162,7 +1151,7 @@ mod tests {
|
|||
|
||||
impl Focusable for AtMentionEditor {
|
||||
fn focus_handle(&self, cx: &App) -> FocusHandle {
|
||||
self.0.read(cx).focus_handle(cx).clone()
|
||||
self.0.read(cx).focus_handle(cx)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1480,7 +1469,7 @@ mod tests {
|
|||
let completions = editor.current_completions().expect("Missing completions");
|
||||
completions
|
||||
.into_iter()
|
||||
.map(|completion| completion.label.text.to_string())
|
||||
.map(|completion| completion.label.text)
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
|
|
|
@ -1693,7 +1693,7 @@ impl InlineAssist {
|
|||
}),
|
||||
range,
|
||||
codegen: codegen.clone(),
|
||||
workspace: workspace.clone(),
|
||||
workspace,
|
||||
_subscriptions: vec![
|
||||
window.on_focus_in(&prompt_editor_focus_handle, cx, move |_, cx| {
|
||||
InlineAssistant::update_global(cx, |this, cx| {
|
||||
|
|
|
@ -93,7 +93,7 @@ impl LanguageModelPickerDelegate {
|
|||
let entries = models.entries();
|
||||
|
||||
Self {
|
||||
on_model_changed: on_model_changed.clone(),
|
||||
on_model_changed,
|
||||
all_models: Arc::new(models),
|
||||
selected_index: Self::get_active_model_index(&entries, get_active_model(cx)),
|
||||
filtered_entries: entries,
|
||||
|
@ -514,7 +514,7 @@ impl PickerDelegate for LanguageModelPickerDelegate {
|
|||
.pl_0p5()
|
||||
.gap_1p5()
|
||||
.w(px(240.))
|
||||
.child(Label::new(model_info.model.name().0.clone()).truncate()),
|
||||
.child(Label::new(model_info.model.name().0).truncate()),
|
||||
)
|
||||
.end_slot(div().pr_3().when(is_selected, |this| {
|
||||
this.child(
|
||||
|
|
|
@ -248,7 +248,7 @@ impl MessageEditor {
|
|||
editor: editor.clone(),
|
||||
project: thread.read(cx).project().clone(),
|
||||
thread,
|
||||
incompatible_tools_state: incompatible_tools.clone(),
|
||||
incompatible_tools_state: incompatible_tools,
|
||||
workspace,
|
||||
context_store,
|
||||
prompt_store,
|
||||
|
@ -839,7 +839,6 @@ impl MessageEditor {
|
|||
.child(self.profile_selector.clone())
|
||||
.child(self.model_selector.clone())
|
||||
.map({
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |parent| {
|
||||
if is_generating {
|
||||
parent
|
||||
|
@ -1801,7 +1800,7 @@ impl AgentPreview for MessageEditor {
|
|||
.bg(cx.theme().colors().panel_background)
|
||||
.border_1()
|
||||
.border_color(cx.theme().colors().border)
|
||||
.child(default_message_editor.clone())
|
||||
.child(default_message_editor)
|
||||
.into_any_element(),
|
||||
)])
|
||||
.into_any_element(),
|
||||
|
|
|
@ -137,12 +137,11 @@ impl ProfileSelector {
|
|||
entry.handler({
|
||||
let fs = self.fs.clone();
|
||||
let provider = self.provider.clone();
|
||||
let profile_id = profile_id.clone();
|
||||
move |_window, cx| {
|
||||
update_settings_file::<AgentSettings>(fs.clone(), cx, {
|
||||
let profile_id = profile_id.clone();
|
||||
move |settings, _cx| {
|
||||
settings.set_profile(profile_id.clone());
|
||||
settings.set_profile(profile_id);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -175,7 +174,6 @@ impl Render for ProfileSelector {
|
|||
|
||||
PopoverMenu::new("profile-selector")
|
||||
.trigger_with_tooltip(trigger_button, {
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |window, cx| {
|
||||
Tooltip::for_action_in(
|
||||
"Toggle Profile Menu",
|
||||
|
|
|
@ -88,8 +88,6 @@ impl SlashCommandCompletionProvider {
|
|||
.map(|(editor, workspace)| {
|
||||
let command_name = mat.string.clone();
|
||||
let command_range = command_range.clone();
|
||||
let editor = editor.clone();
|
||||
let workspace = workspace.clone();
|
||||
Arc::new(
|
||||
move |intent: CompletionIntent,
|
||||
window: &mut Window,
|
||||
|
@ -158,7 +156,7 @@ impl SlashCommandCompletionProvider {
|
|||
if let Some(command) = self.slash_commands.command(command_name, cx) {
|
||||
let completions = command.complete_argument(
|
||||
arguments,
|
||||
new_cancel_flag.clone(),
|
||||
new_cancel_flag,
|
||||
self.workspace.clone(),
|
||||
window,
|
||||
cx,
|
||||
|
|
|
@ -432,7 +432,7 @@ impl TerminalInlineAssist {
|
|||
terminal: terminal.downgrade(),
|
||||
prompt_editor: Some(prompt_editor.clone()),
|
||||
codegen: codegen.clone(),
|
||||
workspace: workspace.clone(),
|
||||
workspace,
|
||||
context_store,
|
||||
prompt_store,
|
||||
_subscriptions: vec![
|
||||
|
|
|
@ -1739,7 +1739,7 @@ impl TextThreadEditor {
|
|||
render_slash_command_output_toggle,
|
||||
|_, _, _, _| Empty.into_any(),
|
||||
)
|
||||
.with_metadata(metadata.crease.clone())
|
||||
.with_metadata(metadata.crease)
|
||||
}),
|
||||
cx,
|
||||
);
|
||||
|
@ -1810,7 +1810,7 @@ impl TextThreadEditor {
|
|||
.filter_map(|(anchor, render_image)| {
|
||||
const MAX_HEIGHT_IN_LINES: u32 = 8;
|
||||
let anchor = buffer.anchor_in_excerpt(excerpt_id, anchor).unwrap();
|
||||
let image = render_image.clone();
|
||||
let image = render_image;
|
||||
anchor.is_valid(&buffer).then(|| BlockProperties {
|
||||
placement: BlockPlacement::Above(anchor),
|
||||
height: Some(MAX_HEIGHT_IN_LINES),
|
||||
|
@ -1873,7 +1873,7 @@ impl TextThreadEditor {
|
|||
}
|
||||
|
||||
fn render_send_button(&self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
|
||||
let focus_handle = self.focus_handle(cx).clone();
|
||||
let focus_handle = self.focus_handle(cx);
|
||||
|
||||
let (style, tooltip) = match token_state(&self.context, cx) {
|
||||
Some(TokenState::NoTokensLeft { .. }) => (
|
||||
|
@ -2015,7 +2015,7 @@ impl TextThreadEditor {
|
|||
None => IconName::Ai,
|
||||
};
|
||||
|
||||
let focus_handle = self.editor().focus_handle(cx).clone();
|
||||
let focus_handle = self.editor().focus_handle(cx);
|
||||
|
||||
PickerPopoverMenu::new(
|
||||
self.language_model_selector.clone(),
|
||||
|
|
|
@ -499,7 +499,7 @@ impl AddedContext {
|
|||
let thread = handle.thread.clone();
|
||||
Some(Rc::new(move |_, cx| {
|
||||
let text = thread.read(cx).latest_detailed_summary_or_text();
|
||||
ContextPillHover::new_text(text.clone(), cx).into()
|
||||
ContextPillHover::new_text(text, cx).into()
|
||||
}))
|
||||
},
|
||||
handle: AgentContextHandle::Thread(handle),
|
||||
|
@ -574,7 +574,7 @@ impl AddedContext {
|
|||
.unwrap_or_else(|| "Unnamed Rule".into());
|
||||
Some(AddedContext {
|
||||
kind: ContextKind::Rules,
|
||||
name: title.clone(),
|
||||
name: title,
|
||||
parent: None,
|
||||
tooltip: None,
|
||||
icon_path: None,
|
||||
|
|
|
@ -33,7 +33,7 @@ impl ApiKeysWithProviders {
|
|||
.filter(|provider| {
|
||||
provider.is_authenticated(cx) && provider.id() != ZED_CLOUD_PROVIDER_ID
|
||||
})
|
||||
.map(|provider| (provider.icon(), provider.name().0.clone()))
|
||||
.map(|provider| (provider.icon(), provider.name().0))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ impl AgentPanelOnboarding {
|
|||
.filter(|provider| {
|
||||
provider.is_authenticated(cx) && provider.id() != ZED_CLOUD_PROVIDER_ID
|
||||
})
|
||||
.map(|provider| (provider.icon(), provider.name().0.clone()))
|
||||
.map(|provider| (provider.icon(), provider.name().0))
|
||||
.collect()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2282,7 +2282,7 @@ impl AssistantContext {
|
|||
let mut contents = self.contents(cx).peekable();
|
||||
|
||||
fn collect_text_content(buffer: &Buffer, range: Range<usize>) -> Option<String> {
|
||||
let text: String = buffer.text_for_range(range.clone()).collect();
|
||||
let text: String = buffer.text_for_range(range).collect();
|
||||
if text.trim().is_empty() {
|
||||
None
|
||||
} else {
|
||||
|
|
|
@ -1321,7 +1321,7 @@ fn test_summarize_error(
|
|||
fn setup_context_editor_with_fake_model(
|
||||
cx: &mut TestAppContext,
|
||||
) -> (Entity<AssistantContext>, Arc<FakeLanguageModel>) {
|
||||
let registry = Arc::new(LanguageRegistry::test(cx.executor().clone()));
|
||||
let registry = Arc::new(LanguageRegistry::test(cx.executor()));
|
||||
|
||||
let fake_provider = Arc::new(FakeLanguageModelProvider::default());
|
||||
let fake_model = Arc::new(fake_provider.test_model());
|
||||
|
@ -1376,7 +1376,7 @@ fn messages_cache(
|
|||
context
|
||||
.read(cx)
|
||||
.messages(cx)
|
||||
.map(|message| (message.id, message.cache.clone()))
|
||||
.map(|message| (message.id, message.cache))
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
|
@ -862,7 +862,7 @@ impl ContextStore {
|
|||
ContextServerStatus::Running => {
|
||||
self.load_context_server_slash_commands(
|
||||
server_id.clone(),
|
||||
context_server_store.clone(),
|
||||
context_server_store,
|
||||
cx,
|
||||
);
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ impl DiagnosticsSlashCommand {
|
|||
score: 0.,
|
||||
positions: Vec::new(),
|
||||
worktree_id: entry.worktree_id.to_usize(),
|
||||
path: entry.path.clone(),
|
||||
path: entry.path,
|
||||
path_prefix: path_prefix.clone(),
|
||||
is_dir: false, // Diagnostics can't be produced for directories
|
||||
distance_to_relative_ancestor: 0,
|
||||
|
|
|
@ -80,7 +80,7 @@ impl SlashCommand for PromptSlashCommand {
|
|||
};
|
||||
|
||||
let store = PromptStore::global(cx);
|
||||
let title = SharedString::from(title.clone());
|
||||
let title = SharedString::from(title);
|
||||
let prompt = cx.spawn({
|
||||
let title = title.clone();
|
||||
async move |cx| {
|
||||
|
|
|
@ -1153,8 +1153,7 @@ impl EvalInput {
|
|||
.expect("Conversation must end with an edit_file tool use")
|
||||
.clone();
|
||||
|
||||
let edit_file_input: EditFileToolInput =
|
||||
serde_json::from_value(tool_use.input.clone()).unwrap();
|
||||
let edit_file_input: EditFileToolInput = serde_json::from_value(tool_use.input).unwrap();
|
||||
|
||||
EvalInput {
|
||||
conversation,
|
||||
|
@ -1460,7 +1459,7 @@ impl EditAgentTest {
|
|||
async fn new(cx: &mut TestAppContext) -> Self {
|
||||
cx.executor().allow_parking();
|
||||
|
||||
let fs = FakeFs::new(cx.executor().clone());
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
cx.update(|cx| {
|
||||
settings::init(cx);
|
||||
gpui_tokio::init(cx);
|
||||
|
@ -1475,7 +1474,7 @@ impl EditAgentTest {
|
|||
Project::init_settings(cx);
|
||||
language::init(cx);
|
||||
language_model::init(client.clone(), cx);
|
||||
language_models::init(user_store.clone(), client.clone(), cx);
|
||||
language_models::init(user_store, client.clone(), cx);
|
||||
crate::init(client.http_client(), cx);
|
||||
});
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ mod tests {
|
|||
);
|
||||
let snapshot = buffer.snapshot();
|
||||
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot.clone());
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot);
|
||||
assert_eq!(push(&mut finder, ""), None);
|
||||
assert_eq!(finish(finder), None);
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ mod tests {
|
|||
);
|
||||
let snapshot = buffer.snapshot();
|
||||
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot.clone());
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot);
|
||||
|
||||
// Push partial query
|
||||
assert_eq!(push(&mut finder, "This"), None);
|
||||
|
@ -365,7 +365,7 @@ mod tests {
|
|||
);
|
||||
let snapshot = buffer.snapshot();
|
||||
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot.clone());
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot);
|
||||
|
||||
// Push a fuzzy query that should match the first function
|
||||
assert_eq!(
|
||||
|
@ -391,7 +391,7 @@ mod tests {
|
|||
);
|
||||
let snapshot = buffer.snapshot();
|
||||
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot.clone());
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot);
|
||||
|
||||
// No match initially
|
||||
assert_eq!(push(&mut finder, "Lin"), None);
|
||||
|
@ -420,7 +420,7 @@ mod tests {
|
|||
);
|
||||
let snapshot = buffer.snapshot();
|
||||
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot.clone());
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot);
|
||||
|
||||
// Push text in small chunks across line boundaries
|
||||
assert_eq!(push(&mut finder, "jumps "), None); // No newline yet
|
||||
|
@ -458,7 +458,7 @@ mod tests {
|
|||
);
|
||||
let snapshot = buffer.snapshot();
|
||||
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot.clone());
|
||||
let mut finder = StreamingFuzzyMatcher::new(snapshot);
|
||||
|
||||
assert_eq!(
|
||||
push(&mut finder, "impl Debug for User {\n"),
|
||||
|
@ -711,7 +711,7 @@ mod tests {
|
|||
"Expected to match `second_function` based on the line hint"
|
||||
);
|
||||
|
||||
let mut matcher = StreamingFuzzyMatcher::new(snapshot.clone());
|
||||
let mut matcher = StreamingFuzzyMatcher::new(snapshot);
|
||||
matcher.push(query, None);
|
||||
matcher.finish();
|
||||
let best_match = matcher.select_best_match();
|
||||
|
@ -727,7 +727,7 @@ mod tests {
|
|||
let buffer = TextBuffer::new(0, BufferId::new(1).unwrap(), text.clone());
|
||||
let snapshot = buffer.snapshot();
|
||||
|
||||
let mut matcher = StreamingFuzzyMatcher::new(snapshot.clone());
|
||||
let mut matcher = StreamingFuzzyMatcher::new(snapshot);
|
||||
|
||||
// Split query into random chunks
|
||||
let chunks = to_random_chunks(rng, query);
|
||||
|
|
|
@ -376,7 +376,7 @@ impl Tool for EditFileTool {
|
|||
|
||||
let output = EditFileToolOutput {
|
||||
original_path: project_path.path.to_path_buf(),
|
||||
new_text: new_text.clone(),
|
||||
new_text,
|
||||
old_text,
|
||||
raw_output: Some(agent_output),
|
||||
};
|
||||
|
@ -643,7 +643,7 @@ impl EditFileToolCard {
|
|||
diff
|
||||
});
|
||||
|
||||
self.buffer = Some(buffer.clone());
|
||||
self.buffer = Some(buffer);
|
||||
self.base_text = Some(base_text.into());
|
||||
self.buffer_diff = Some(buffer_diff.clone());
|
||||
|
||||
|
@ -776,7 +776,6 @@ impl EditFileToolCard {
|
|||
|
||||
let buffer_diff = cx.spawn({
|
||||
let buffer = buffer.clone();
|
||||
let language_registry = language_registry.clone();
|
||||
async move |_this, cx| {
|
||||
build_buffer_diff(base_text, &buffer, &language_registry, cx).await
|
||||
}
|
||||
|
@ -863,7 +862,6 @@ impl ToolCard for EditFileToolCard {
|
|||
)
|
||||
.on_click({
|
||||
let path = self.path.clone();
|
||||
let workspace = workspace.clone();
|
||||
move |_, window, cx| {
|
||||
workspace
|
||||
.update(cx, {
|
||||
|
|
|
@ -327,7 +327,7 @@ mod tests {
|
|||
init_test(cx);
|
||||
cx.executor().allow_parking();
|
||||
|
||||
let fs = FakeFs::new(cx.executor().clone());
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
fs.insert_tree(
|
||||
path!("/root"),
|
||||
serde_json::json!({
|
||||
|
@ -415,7 +415,7 @@ mod tests {
|
|||
init_test(cx);
|
||||
cx.executor().allow_parking();
|
||||
|
||||
let fs = FakeFs::new(cx.executor().clone());
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
fs.insert_tree(
|
||||
path!("/root"),
|
||||
serde_json::json!({
|
||||
|
@ -494,7 +494,7 @@ mod tests {
|
|||
init_test(cx);
|
||||
cx.executor().allow_parking();
|
||||
|
||||
let fs = FakeFs::new(cx.executor().clone());
|
||||
let fs = FakeFs::new(cx.executor());
|
||||
|
||||
// Create test file with syntax structures
|
||||
fs.insert_tree(
|
||||
|
|
|
@ -350,7 +350,7 @@ fn process_content(
|
|||
if is_empty {
|
||||
"Command executed successfully.".to_string()
|
||||
} else {
|
||||
content.to_string()
|
||||
content
|
||||
}
|
||||
}
|
||||
Some(exit_status) => {
|
||||
|
|
|
@ -101,14 +101,11 @@ impl RenderOnce for ToolCallCardHeader {
|
|||
})
|
||||
.when_some(secondary_text, |this, secondary_text| {
|
||||
this.child(bullet_divider())
|
||||
.child(div().text_size(font_size).child(secondary_text.clone()))
|
||||
.child(div().text_size(font_size).child(secondary_text))
|
||||
})
|
||||
.when_some(code_path, |this, code_path| {
|
||||
this.child(bullet_divider()).child(
|
||||
Label::new(code_path.clone())
|
||||
.size(LabelSize::Small)
|
||||
.inline_code(cx),
|
||||
)
|
||||
this.child(bullet_divider())
|
||||
.child(Label::new(code_path).size(LabelSize::Small).inline_code(cx))
|
||||
})
|
||||
.with_animation(
|
||||
"loading-label",
|
||||
|
|
|
@ -193,10 +193,7 @@ impl ToolCard for WebSearchToolCard {
|
|||
)
|
||||
}
|
||||
})
|
||||
.on_click({
|
||||
let url = url.clone();
|
||||
move |_, _, cx| cx.open_url(&url)
|
||||
})
|
||||
.on_click(move |_, _, cx| cx.open_url(&url))
|
||||
}))
|
||||
.into_any(),
|
||||
),
|
||||
|
|
|
@ -114,7 +114,7 @@ fn view_release_notes_locally(
|
|||
cx,
|
||||
);
|
||||
workspace.add_item_to_active_pane(
|
||||
Box::new(markdown_preview.clone()),
|
||||
Box::new(markdown_preview),
|
||||
None,
|
||||
true,
|
||||
window,
|
||||
|
|
|
@ -175,12 +175,8 @@ impl BufferDiffSnapshot {
|
|||
if let Some(text) = &base_text {
|
||||
let base_text_rope = Rope::from(text.as_str());
|
||||
base_text_pair = Some((text.clone(), base_text_rope.clone()));
|
||||
let snapshot = language::Buffer::build_snapshot(
|
||||
base_text_rope,
|
||||
language.clone(),
|
||||
language_registry.clone(),
|
||||
cx,
|
||||
);
|
||||
let snapshot =
|
||||
language::Buffer::build_snapshot(base_text_rope, language, language_registry, cx);
|
||||
base_text_snapshot = cx.background_spawn(snapshot);
|
||||
base_text_exists = true;
|
||||
} else {
|
||||
|
@ -957,7 +953,7 @@ impl BufferDiff {
|
|||
.buffer_range
|
||||
.start;
|
||||
let end = self
|
||||
.hunks_intersecting_range_rev(range.clone(), buffer)
|
||||
.hunks_intersecting_range_rev(range, buffer)
|
||||
.next()?
|
||||
.buffer_range
|
||||
.end;
|
||||
|
@ -1441,7 +1437,7 @@ mod tests {
|
|||
.unindent();
|
||||
|
||||
let buffer = Buffer::new(0, BufferId::new(1).unwrap(), buffer_text);
|
||||
let unstaged_diff = BufferDiffSnapshot::new_sync(buffer.clone(), index_text.clone(), cx);
|
||||
let unstaged_diff = BufferDiffSnapshot::new_sync(buffer.clone(), index_text, cx);
|
||||
let mut uncommitted_diff =
|
||||
BufferDiffSnapshot::new_sync(buffer.clone(), head_text.clone(), cx);
|
||||
uncommitted_diff.secondary_diff = Some(Box::new(unstaged_diff));
|
||||
|
|
|
@ -438,7 +438,7 @@ fn init_test(cx: &mut App) -> Entity<ChannelStore> {
|
|||
|
||||
let clock = Arc::new(FakeSystemClock::new());
|
||||
let http = FakeHttpClient::with_404_response();
|
||||
let client = Client::new(clock, http.clone(), cx);
|
||||
let client = Client::new(clock, http, cx);
|
||||
let user_store = cx.new(|cx| UserStore::new(client.clone(), cx));
|
||||
|
||||
client::init(&client, cx);
|
||||
|
|
|
@ -926,7 +926,7 @@ mod mac_os {
|
|||
|
||||
fn path(&self) -> PathBuf {
|
||||
match self {
|
||||
Bundle::App { app_bundle, .. } => app_bundle.join("Contents/MacOS/zed").clone(),
|
||||
Bundle::App { app_bundle, .. } => app_bundle.join("Contents/MacOS/zed"),
|
||||
Bundle::LocalPath { executable, .. } => executable.clone(),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ pub fn init(client: &Arc<Client>, cx: &mut App) {
|
|||
});
|
||||
|
||||
cx.on_action({
|
||||
let client = client.clone();
|
||||
let client = client;
|
||||
move |_: &Reconnect, cx| {
|
||||
if let Some(client) = client.upgrade() {
|
||||
cx.spawn(async move |cx| {
|
||||
|
@ -791,7 +791,7 @@ impl Client {
|
|||
Arc::new(move |subscriber, envelope, client, cx| {
|
||||
let subscriber = subscriber.downcast::<E>().unwrap();
|
||||
let envelope = envelope.into_any().downcast::<TypedEnvelope<M>>().unwrap();
|
||||
handler(subscriber, *envelope, client.clone(), cx).boxed_local()
|
||||
handler(subscriber, *envelope, client, cx).boxed_local()
|
||||
}),
|
||||
);
|
||||
if prev_handler.is_some() {
|
||||
|
@ -2048,10 +2048,7 @@ mod tests {
|
|||
assert_eq!(*auth_count.lock(), 1);
|
||||
assert_eq!(*dropped_auth_count.lock(), 0);
|
||||
|
||||
let _authenticate = cx.spawn({
|
||||
let client = client.clone();
|
||||
|cx| async move { client.connect(false, &cx).await }
|
||||
});
|
||||
let _authenticate = cx.spawn(|cx| async move { client.connect(false, &cx).await });
|
||||
executor.run_until_parked();
|
||||
assert_eq!(*auth_count.lock(), 2);
|
||||
assert_eq!(*dropped_auth_count.lock(), 1);
|
||||
|
|
|
@ -739,7 +739,7 @@ mod tests {
|
|||
);
|
||||
|
||||
// Third scan of worktree does not double report, as we already reported
|
||||
test_project_discovery_helper(telemetry.clone(), vec!["package.json"], None, worktree_id);
|
||||
test_project_discovery_helper(telemetry, vec!["package.json"], None, worktree_id);
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
|
@ -751,7 +751,7 @@ mod tests {
|
|||
let telemetry = cx.update(|cx| Telemetry::new(clock.clone(), http, cx));
|
||||
|
||||
test_project_discovery_helper(
|
||||
telemetry.clone(),
|
||||
telemetry,
|
||||
vec!["package.json", "pnpm-lock.yaml"],
|
||||
Some(vec!["node", "pnpm"]),
|
||||
1,
|
||||
|
@ -767,7 +767,7 @@ mod tests {
|
|||
let telemetry = cx.update(|cx| Telemetry::new(clock.clone(), http, cx));
|
||||
|
||||
test_project_discovery_helper(
|
||||
telemetry.clone(),
|
||||
telemetry,
|
||||
vec!["package.json", "yarn.lock"],
|
||||
Some(vec!["node", "yarn"]),
|
||||
1,
|
||||
|
@ -786,7 +786,7 @@ mod tests {
|
|||
// project type for the same worktree multiple times
|
||||
|
||||
test_project_discovery_helper(
|
||||
telemetry.clone().clone(),
|
||||
telemetry.clone(),
|
||||
vec!["global.json"],
|
||||
Some(vec!["dotnet"]),
|
||||
1,
|
||||
|
|
|
@ -280,7 +280,7 @@ pub async fn post_hang(
|
|||
service = "client",
|
||||
version = %report.app_version.unwrap_or_default().to_string(),
|
||||
os_name = %report.os_name,
|
||||
os_version = report.os_version.unwrap_or_default().to_string(),
|
||||
os_version = report.os_version.unwrap_or_default(),
|
||||
incident_id = %incident_id,
|
||||
installation_id = %report.installation_id.unwrap_or_default(),
|
||||
backtrace = %backtrace,
|
||||
|
|
|
@ -236,7 +236,7 @@ mod test {
|
|||
|
||||
#[gpui::test]
|
||||
async fn test_verify_access_token(cx: &mut gpui::TestAppContext) {
|
||||
let test_db = crate::db::TestDb::sqlite(cx.executor().clone());
|
||||
let test_db = crate::db::TestDb::sqlite(cx.executor());
|
||||
let db = test_db.db();
|
||||
|
||||
let user = db
|
||||
|
|
|
@ -8,7 +8,7 @@ use time::{Duration, OffsetDateTime, PrimitiveDateTime};
|
|||
// SQLite does not support array arguments, so we only test this against a real postgres instance
|
||||
#[gpui::test]
|
||||
async fn test_get_embeddings_postgres(cx: &mut gpui::TestAppContext) {
|
||||
let test_db = TestDb::postgres(cx.executor().clone());
|
||||
let test_db = TestDb::postgres(cx.executor());
|
||||
let db = test_db.db();
|
||||
|
||||
let provider = "test_model";
|
||||
|
@ -38,7 +38,7 @@ async fn test_get_embeddings_postgres(cx: &mut gpui::TestAppContext) {
|
|||
|
||||
#[gpui::test]
|
||||
async fn test_purge_old_embeddings(cx: &mut gpui::TestAppContext) {
|
||||
let test_db = TestDb::postgres(cx.executor().clone());
|
||||
let test_db = TestDb::postgres(cx.executor());
|
||||
let db = test_db.db();
|
||||
|
||||
let model = "test_model";
|
||||
|
|
|
@ -310,7 +310,7 @@ impl Server {
|
|||
let mut server = Self {
|
||||
id: parking_lot::Mutex::new(id),
|
||||
peer: Peer::new(id.0 as u32),
|
||||
app_state: app_state.clone(),
|
||||
app_state,
|
||||
connection_pool: Default::default(),
|
||||
handlers: Default::default(),
|
||||
teardown: watch::channel(false).0,
|
||||
|
@ -1386,9 +1386,7 @@ async fn create_room(
|
|||
let live_kit = live_kit?;
|
||||
let user_id = session.user_id().to_string();
|
||||
|
||||
let token = live_kit
|
||||
.room_token(&livekit_room, &user_id.to_string())
|
||||
.trace_err()?;
|
||||
let token = live_kit.room_token(&livekit_room, &user_id).trace_err()?;
|
||||
|
||||
Some(proto::LiveKitConnectionInfo {
|
||||
server_url: live_kit.url().into(),
|
||||
|
@ -2015,9 +2013,9 @@ async fn join_project(
|
|||
.unzip();
|
||||
response.send(proto::JoinProjectResponse {
|
||||
project_id: project.id.0 as u64,
|
||||
worktrees: worktrees.clone(),
|
||||
worktrees,
|
||||
replica_id: replica_id.0 as u32,
|
||||
collaborators: collaborators.clone(),
|
||||
collaborators,
|
||||
language_servers,
|
||||
language_server_capabilities,
|
||||
role: project.role.into(),
|
||||
|
|
|
@ -3593,7 +3593,7 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
|
|||
let abs_path = project_a.read_with(cx_a, |project, cx| {
|
||||
project
|
||||
.absolute_path(&project_path, cx)
|
||||
.map(|path_buf| Arc::from(path_buf.to_owned()))
|
||||
.map(Arc::from)
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
|
@ -3647,20 +3647,16 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
|
|||
let breakpoints_a = editor_a.update(cx_a, |editor, cx| {
|
||||
editor
|
||||
.breakpoint_store()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
.clone()
|
||||
});
|
||||
let breakpoints_b = editor_b.update(cx_b, |editor, cx| {
|
||||
editor
|
||||
.breakpoint_store()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
.clone()
|
||||
});
|
||||
|
||||
assert_eq!(1, breakpoints_a.len());
|
||||
|
@ -3680,20 +3676,16 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
|
|||
let breakpoints_a = editor_a.update(cx_a, |editor, cx| {
|
||||
editor
|
||||
.breakpoint_store()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
.clone()
|
||||
});
|
||||
let breakpoints_b = editor_b.update(cx_b, |editor, cx| {
|
||||
editor
|
||||
.breakpoint_store()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
.clone()
|
||||
});
|
||||
|
||||
assert_eq!(1, breakpoints_a.len());
|
||||
|
@ -3713,20 +3705,16 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
|
|||
let breakpoints_a = editor_a.update(cx_a, |editor, cx| {
|
||||
editor
|
||||
.breakpoint_store()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
.clone()
|
||||
});
|
||||
let breakpoints_b = editor_b.update(cx_b, |editor, cx| {
|
||||
editor
|
||||
.breakpoint_store()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
.clone()
|
||||
});
|
||||
|
||||
assert_eq!(1, breakpoints_a.len());
|
||||
|
@ -3746,20 +3734,16 @@ async fn test_add_breakpoints(cx_a: &mut TestAppContext, cx_b: &mut TestAppConte
|
|||
let breakpoints_a = editor_a.update(cx_a, |editor, cx| {
|
||||
editor
|
||||
.breakpoint_store()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
.clone()
|
||||
});
|
||||
let breakpoints_b = editor_b.update(cx_b, |editor, cx| {
|
||||
editor
|
||||
.breakpoint_store()
|
||||
.clone()
|
||||
.unwrap()
|
||||
.read(cx)
|
||||
.all_source_breakpoints(cx)
|
||||
.clone()
|
||||
});
|
||||
|
||||
assert_eq!(0, breakpoints_a.len());
|
||||
|
|
|
@ -266,7 +266,7 @@ impl RandomizedTest for RandomChannelBufferTest {
|
|||
"client {user_id} has different text than client {prev_user_id} for channel {channel_name}",
|
||||
);
|
||||
} else {
|
||||
prev_text = Some((user_id, text.clone()));
|
||||
prev_text = Some((user_id, text));
|
||||
}
|
||||
|
||||
// Assert that all clients and the server agree about who is present in the
|
||||
|
|
|
@ -643,7 +643,7 @@ impl RandomizedTest for ProjectCollaborationTest {
|
|||
);
|
||||
|
||||
let project = project.await?;
|
||||
client.dev_server_projects_mut().push(project.clone());
|
||||
client.dev_server_projects_mut().push(project);
|
||||
}
|
||||
|
||||
ClientOperation::CreateWorktreeEntry {
|
||||
|
|
|
@ -370,8 +370,8 @@ impl TestServer {
|
|||
let client = TestClient {
|
||||
app_state,
|
||||
username: name.to_string(),
|
||||
channel_store: cx.read(ChannelStore::global).clone(),
|
||||
notification_store: cx.read(NotificationStore::global).clone(),
|
||||
channel_store: cx.read(ChannelStore::global),
|
||||
notification_store: cx.read(NotificationStore::global),
|
||||
state: Default::default(),
|
||||
};
|
||||
client.wait_for_current_user(cx).await;
|
||||
|
|
|
@ -66,7 +66,7 @@ impl ChannelView {
|
|||
channel_id,
|
||||
link_position,
|
||||
pane.clone(),
|
||||
workspace.clone(),
|
||||
workspace,
|
||||
window,
|
||||
cx,
|
||||
);
|
||||
|
|
|
@ -1038,7 +1038,7 @@ impl Render for ChatPanel {
|
|||
.cloned();
|
||||
|
||||
el.when_some(reply_message, |el, reply_message| {
|
||||
let user_being_replied_to = reply_message.sender.clone();
|
||||
let user_being_replied_to = reply_message.sender;
|
||||
|
||||
el.child(
|
||||
h_flex()
|
||||
|
|
|
@ -2507,7 +2507,7 @@ impl CollabPanel {
|
|||
|
||||
let button = match section {
|
||||
Section::ActiveCall => channel_link.map(|channel_link| {
|
||||
let channel_link_copy = channel_link.clone();
|
||||
let channel_link_copy = channel_link;
|
||||
IconButton::new("channel-link", IconName::Copy)
|
||||
.icon_size(IconSize::Small)
|
||||
.size(ButtonSize::None)
|
||||
|
@ -2691,7 +2691,7 @@ impl CollabPanel {
|
|||
h_flex()
|
||||
.w_full()
|
||||
.justify_between()
|
||||
.child(Label::new(github_login.clone()))
|
||||
.child(Label::new(github_login))
|
||||
.child(h_flex().children(controls)),
|
||||
)
|
||||
.start_slot(Avatar::new(user.avatar_uri.clone()))
|
||||
|
@ -3125,7 +3125,7 @@ impl Panel for CollabPanel {
|
|||
|
||||
impl Focusable for CollabPanel {
|
||||
fn focus_handle(&self, cx: &App) -> gpui::FocusHandle {
|
||||
self.filter_editor.focus_handle(cx).clone()
|
||||
self.filter_editor.focus_handle(cx)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ impl NotificationPanel {
|
|||
.gap_1()
|
||||
.size_full()
|
||||
.overflow_hidden()
|
||||
.child(Label::new(text.clone()))
|
||||
.child(Label::new(text))
|
||||
.child(
|
||||
h_flex()
|
||||
.child(
|
||||
|
|
|
@ -206,7 +206,7 @@ impl CommandPaletteDelegate {
|
|||
if parse_zed_link(&query, cx).is_some() {
|
||||
intercept_results = vec![CommandInterceptResult {
|
||||
action: OpenZedUrl { url: query.clone() }.boxed_clone(),
|
||||
string: query.clone(),
|
||||
string: query,
|
||||
positions: vec![],
|
||||
}]
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ impl RenderOnce for ComponentExample {
|
|||
div()
|
||||
.text_size(rems(0.875))
|
||||
.text_color(cx.theme().colors().text_muted)
|
||||
.child(description.clone()),
|
||||
.child(description),
|
||||
)
|
||||
}),
|
||||
)
|
||||
|
|
|
@ -112,7 +112,6 @@ impl McpServer {
|
|||
annotations: Some(tool.annotations()),
|
||||
},
|
||||
handler: Box::new({
|
||||
let tool = tool.clone();
|
||||
move |input_value, cx| {
|
||||
let input = match input_value {
|
||||
Some(input) => serde_json::from_value(input),
|
||||
|
|
|
@ -81,10 +81,7 @@ pub fn init(
|
|||
};
|
||||
copilot_chat::init(fs.clone(), http.clone(), configuration, cx);
|
||||
|
||||
let copilot = cx.new({
|
||||
let node_runtime = node_runtime.clone();
|
||||
move |cx| Copilot::start(new_server_id, fs, node_runtime, cx)
|
||||
});
|
||||
let copilot = cx.new(move |cx| Copilot::start(new_server_id, fs, node_runtime, cx));
|
||||
Copilot::set_global(copilot.clone(), cx);
|
||||
cx.observe(&copilot, |copilot, cx| {
|
||||
copilot.update(cx, |copilot, cx| copilot.update_action_visibilities(cx));
|
||||
|
|
|
@ -1083,7 +1083,7 @@ mod tests {
|
|||
let replace_range_marker: TextRangeMarker = ('<', '>').into();
|
||||
let (_, mut marked_ranges) = marked_text_ranges_by(
|
||||
marked_string,
|
||||
vec![complete_from_marker.clone(), replace_range_marker.clone()],
|
||||
vec![complete_from_marker, replace_range_marker.clone()],
|
||||
);
|
||||
|
||||
let replace_range =
|
||||
|
|
|
@ -664,7 +664,7 @@ impl ToolbarItemView for DapLogToolbarItemView {
|
|||
if let Some(item) = active_pane_item
|
||||
&& let Some(log_view) = item.downcast::<DapLogView>()
|
||||
{
|
||||
self.log_view = Some(log_view.clone());
|
||||
self.log_view = Some(log_view);
|
||||
return workspace::ToolbarItemLocation::PrimaryLeft;
|
||||
}
|
||||
self.log_view = None;
|
||||
|
|
|
@ -386,10 +386,10 @@ impl DebugPanel {
|
|||
return;
|
||||
};
|
||||
|
||||
let dap_store_handle = self.project.read(cx).dap_store().clone();
|
||||
let dap_store_handle = self.project.read(cx).dap_store();
|
||||
let label = curr_session.read(cx).label();
|
||||
let quirks = curr_session.read(cx).quirks();
|
||||
let adapter = curr_session.read(cx).adapter().clone();
|
||||
let adapter = curr_session.read(cx).adapter();
|
||||
let binary = curr_session.read(cx).binary().cloned().unwrap();
|
||||
let task_context = curr_session.read(cx).task_context().clone();
|
||||
|
||||
|
@ -447,9 +447,9 @@ impl DebugPanel {
|
|||
return;
|
||||
};
|
||||
|
||||
let dap_store_handle = self.project.read(cx).dap_store().clone();
|
||||
let dap_store_handle = self.project.read(cx).dap_store();
|
||||
let label = self.label_for_child_session(&parent_session, request, cx);
|
||||
let adapter = parent_session.read(cx).adapter().clone();
|
||||
let adapter = parent_session.read(cx).adapter();
|
||||
let quirks = parent_session.read(cx).quirks();
|
||||
let Some(mut binary) = parent_session.read(cx).binary().cloned() else {
|
||||
log::error!("Attempted to start a child-session without a binary");
|
||||
|
@ -932,7 +932,6 @@ impl DebugPanel {
|
|||
.cloned(),
|
||||
|this, running_state| {
|
||||
this.children({
|
||||
let running_state = running_state.clone();
|
||||
let threads =
|
||||
running_state.update(cx, |running_state, cx| {
|
||||
let session = running_state.session();
|
||||
|
@ -1645,7 +1644,6 @@ impl Render for DebugPanel {
|
|||
}
|
||||
})
|
||||
.on_action({
|
||||
let this = this.clone();
|
||||
move |_: &ToggleSessionPicker, window, cx| {
|
||||
this.update(cx, |this, cx| {
|
||||
this.toggle_session_picker(window, cx);
|
||||
|
|
|
@ -272,7 +272,6 @@ pub fn init(cx: &mut App) {
|
|||
}
|
||||
})
|
||||
.on_action({
|
||||
let active_item = active_item.clone();
|
||||
move |_: &ToggleIgnoreBreakpoints, _, cx| {
|
||||
active_item
|
||||
.update(cx, |item, cx| item.toggle_ignore_breakpoints(cx))
|
||||
|
@ -293,9 +292,8 @@ pub fn init(cx: &mut App) {
|
|||
let Some(debug_panel) = workspace.read(cx).panel::<DebugPanel>(cx) else {
|
||||
return;
|
||||
};
|
||||
let Some(active_session) = debug_panel
|
||||
.clone()
|
||||
.update(cx, |panel, _| panel.active_session())
|
||||
let Some(active_session) =
|
||||
debug_panel.update(cx, |panel, _| panel.active_session())
|
||||
else {
|
||||
return;
|
||||
};
|
||||
|
|
|
@ -272,10 +272,9 @@ impl DebugPanel {
|
|||
.child(session_entry.label_element(self_depth, cx))
|
||||
.child(
|
||||
IconButton::new("close-debug-session", IconName::Close)
|
||||
.visible_on_hover(id.clone())
|
||||
.visible_on_hover(id)
|
||||
.icon_size(IconSize::Small)
|
||||
.on_click({
|
||||
let weak = weak.clone();
|
||||
move |_, window, cx| {
|
||||
weak.update(cx, |panel, cx| {
|
||||
panel.close_session(session_entity_id, window, cx);
|
||||
|
|
|
@ -785,7 +785,7 @@ impl RenderOnce for AttachMode {
|
|||
v_flex()
|
||||
.w_full()
|
||||
.track_focus(&self.attach_picker.focus_handle(cx))
|
||||
.child(self.attach_picker.clone())
|
||||
.child(self.attach_picker)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ pub(crate) fn deserialize_pane_layout(
|
|||
Some(Member::Axis(PaneAxis::load(
|
||||
if should_invert { axis.invert() } else { axis },
|
||||
members,
|
||||
flexes.clone(),
|
||||
flexes,
|
||||
)))
|
||||
}
|
||||
SerializedPaneLayout::Pane(serialized_pane) => {
|
||||
|
|
|
@ -180,7 +180,7 @@ impl SubView {
|
|||
let weak_list = list.downgrade();
|
||||
let focus_handle = list.focus_handle(cx);
|
||||
let this = Self::new(
|
||||
focus_handle.clone(),
|
||||
focus_handle,
|
||||
list.into(),
|
||||
DebuggerPaneItem::BreakpointList,
|
||||
cx,
|
||||
|
@ -1167,9 +1167,9 @@ impl RunningState {
|
|||
id: task::TaskId("debug".to_string()),
|
||||
full_label: title.clone(),
|
||||
label: title.clone(),
|
||||
command: command.clone(),
|
||||
command,
|
||||
args,
|
||||
command_label: title.clone(),
|
||||
command_label: title,
|
||||
cwd,
|
||||
env: envs,
|
||||
use_new_terminal: true,
|
||||
|
@ -1756,7 +1756,7 @@ impl RunningState {
|
|||
this.activate_item(0, false, false, window, cx);
|
||||
});
|
||||
|
||||
let rightmost_pane = new_debugger_pane(workspace.clone(), project.clone(), window, cx);
|
||||
let rightmost_pane = new_debugger_pane(workspace.clone(), project, window, cx);
|
||||
rightmost_pane.update(cx, |this, cx| {
|
||||
this.add_item(
|
||||
Box::new(SubView::new(
|
||||
|
|
|
@ -685,7 +685,6 @@ impl BreakpointList {
|
|||
selection_kind.map(|kind| kind.0) != Some(SelectedBreakpointKind::Source),
|
||||
)
|
||||
.on_click({
|
||||
let focus_handle = focus_handle.clone();
|
||||
move |_, window, cx| {
|
||||
focus_handle.focus(window);
|
||||
window.dispatch_action(UnsetBreakpoint.boxed_clone(), cx)
|
||||
|
@ -1139,7 +1138,6 @@ impl ExceptionBreakpoint {
|
|||
}
|
||||
})
|
||||
.on_click({
|
||||
let list = list.clone();
|
||||
move |_, _, cx| {
|
||||
list.update(cx, |this, cx| {
|
||||
this.toggle_exception_breakpoint(&id, cx);
|
||||
|
|
|
@ -365,7 +365,7 @@ impl Console {
|
|||
Some(ContextMenu::build(window, cx, |context_menu, _, _| {
|
||||
context_menu
|
||||
.when_some(keybinding_target.clone(), |el, keybinding_target| {
|
||||
el.context(keybinding_target.clone())
|
||||
el.context(keybinding_target)
|
||||
})
|
||||
.action("Watch Expression", WatchExpression.boxed_clone())
|
||||
}))
|
||||
|
|
|
@ -57,7 +57,7 @@ impl LoadedSourceList {
|
|||
h_flex()
|
||||
.text_ui_xs(cx)
|
||||
.text_color(cx.theme().colors().text_muted)
|
||||
.when_some(source.path.clone(), |this, path| this.child(path)),
|
||||
.when_some(source.path, |this, path| this.child(path)),
|
||||
)
|
||||
.into_any()
|
||||
}
|
||||
|
|
|
@ -461,7 +461,7 @@ impl MemoryView {
|
|||
let data_breakpoint_info = this.data_breakpoint_info(context.clone(), None, cx);
|
||||
cx.spawn(async move |this, cx| {
|
||||
if let Some(info) = data_breakpoint_info.await {
|
||||
let Some(data_id) = info.data_id.clone() else {
|
||||
let Some(data_id) = info.data_id else {
|
||||
return;
|
||||
};
|
||||
_ = this.update(cx, |this, cx| {
|
||||
|
|
|
@ -157,7 +157,7 @@ impl ModuleList {
|
|||
h_flex()
|
||||
.text_ui_xs(cx)
|
||||
.text_color(cx.theme().colors().text_muted)
|
||||
.when_some(module.path.clone(), |this, path| this.child(path)),
|
||||
.when_some(module.path, |this, path| this.child(path)),
|
||||
)
|
||||
.into_any()
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ impl StackFrameList {
|
|||
self.stack_frames(cx)
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.map(|stack_frame| stack_frame.dap.clone())
|
||||
.map(|stack_frame| stack_frame.dap)
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -224,7 +224,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));
|
||||
}
|
||||
self.entries = entries;
|
||||
|
||||
|
@ -418,7 +418,7 @@ impl StackFrameList {
|
|||
let source = stack_frame.source.clone();
|
||||
let is_selected_frame = Some(ix) == self.selected_ix;
|
||||
|
||||
let path = source.clone().and_then(|s| s.path.or(s.name));
|
||||
let path = source.and_then(|s| s.path.or(s.name));
|
||||
let formatted_path = path.map(|path| format!("{}:{}", path, stack_frame.line,));
|
||||
let formatted_path = formatted_path.map(|path| {
|
||||
Label::new(path)
|
||||
|
|
|
@ -313,7 +313,7 @@ impl VariableList {
|
|||
watcher.variables_reference,
|
||||
watcher.variables_reference,
|
||||
EntryPath::for_watcher(watcher.expression.clone()),
|
||||
DapEntry::Watcher(watcher.clone()),
|
||||
DapEntry::Watcher(watcher),
|
||||
)
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
|
@ -1301,8 +1301,6 @@ impl VariableList {
|
|||
IconName::Close,
|
||||
)
|
||||
.on_click({
|
||||
let weak = weak.clone();
|
||||
let path = path.clone();
|
||||
move |_, window, cx| {
|
||||
weak.update(cx, |variable_list, cx| {
|
||||
variable_list.selection = Some(path.clone());
|
||||
|
@ -1470,7 +1468,6 @@ impl VariableList {
|
|||
}))
|
||||
})
|
||||
.on_secondary_mouse_down(cx.listener({
|
||||
let path = path.clone();
|
||||
let entry = variable.clone();
|
||||
move |this, event: &MouseDownEvent, window, cx| {
|
||||
this.selection = Some(path.clone());
|
||||
|
|
|
@ -1330,7 +1330,6 @@ async fn test_unsetting_breakpoints_on_clear_breakpoint_action(
|
|||
let called_set_breakpoints = Arc::new(AtomicBool::new(false));
|
||||
|
||||
client.on_request::<SetBreakpoints, _>({
|
||||
let called_set_breakpoints = called_set_breakpoints.clone();
|
||||
move |_, args| {
|
||||
assert!(
|
||||
args.breakpoints.is_none_or(|bps| bps.is_empty()),
|
||||
|
@ -1445,7 +1444,6 @@ async fn test_we_send_arguments_from_user_config(
|
|||
let launch_handler_called = Arc::new(AtomicBool::new(false));
|
||||
|
||||
start_debug_session_with(&workspace, cx, debug_definition.clone(), {
|
||||
let debug_definition = debug_definition.clone();
|
||||
let launch_handler_called = launch_handler_called.clone();
|
||||
|
||||
move |client| {
|
||||
|
@ -1783,9 +1781,8 @@ async fn test_debug_adapters_shutdown_on_app_quit(
|
|||
let disconnect_request_received = Arc::new(AtomicBool::new(false));
|
||||
let disconnect_clone = disconnect_request_received.clone();
|
||||
|
||||
let disconnect_clone_for_handler = disconnect_clone.clone();
|
||||
client.on_request::<Disconnect, _>(move |_, _| {
|
||||
disconnect_clone_for_handler.store(true, Ordering::SeqCst);
|
||||
disconnect_clone.store(true, Ordering::SeqCst);
|
||||
Ok(())
|
||||
});
|
||||
|
||||
|
|
|
@ -106,9 +106,7 @@ async fn test_debug_session_substitutes_variables_and_relativizes_paths(
|
|||
);
|
||||
|
||||
let expected_other_field = if input_path.contains("$ZED_WORKTREE_ROOT") {
|
||||
input_path
|
||||
.replace("$ZED_WORKTREE_ROOT", path!("/test/worktree/path"))
|
||||
.to_owned()
|
||||
input_path.replace("$ZED_WORKTREE_ROOT", path!("/test/worktree/path"))
|
||||
} else {
|
||||
input_path.to_string()
|
||||
};
|
||||
|
|
|
@ -61,15 +61,13 @@ impl PreprocessorError {
|
|||
for alias in action.deprecated_aliases {
|
||||
if alias == &action_name {
|
||||
return PreprocessorError::DeprecatedActionUsed {
|
||||
used: action_name.clone(),
|
||||
used: action_name,
|
||||
should_be: action.name.to_string(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
PreprocessorError::ActionNotFound {
|
||||
action_name: action_name.to_string(),
|
||||
}
|
||||
PreprocessorError::ActionNotFound { action_name }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ impl Render for EditPredictionButton {
|
|||
let account_status = agent.account_status.clone();
|
||||
match account_status {
|
||||
AccountStatus::NeedsActivation { activate_url } => {
|
||||
SupermavenButtonStatus::NeedsActivation(activate_url.clone())
|
||||
SupermavenButtonStatus::NeedsActivation(activate_url)
|
||||
}
|
||||
AccountStatus::Unknown => SupermavenButtonStatus::Initializing,
|
||||
AccountStatus::Ready => SupermavenButtonStatus::Ready,
|
||||
|
|
|
@ -514,7 +514,7 @@ impl CompletionsMenu {
|
|||
// Expand the range to resolve more completions than are predicted to be visible, to reduce
|
||||
// jank on navigation.
|
||||
let entry_indices = util::expanded_and_wrapped_usize_range(
|
||||
entry_range.clone(),
|
||||
entry_range,
|
||||
RESOLVE_BEFORE_ITEMS,
|
||||
RESOLVE_AFTER_ITEMS,
|
||||
entries.len(),
|
||||
|
|
|
@ -2156,7 +2156,7 @@ mod tests {
|
|||
}
|
||||
|
||||
let multi_buffer_snapshot = multi_buffer.read(cx).snapshot(cx);
|
||||
let (_, inlay_snapshot) = InlayMap::new(multi_buffer_snapshot.clone());
|
||||
let (_, inlay_snapshot) = InlayMap::new(multi_buffer_snapshot);
|
||||
let (_, fold_snapshot) = FoldMap::new(inlay_snapshot);
|
||||
let (_, tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
|
||||
let (_, wraps_snapshot) = WrapMap::new(tab_snapshot, font, font_size, Some(wrap_width), cx);
|
||||
|
@ -2275,7 +2275,7 @@ mod tests {
|
|||
new_heights.insert(block_ids[0], 3);
|
||||
block_map_writer.resize(new_heights);
|
||||
|
||||
let snapshot = block_map.read(wraps_snapshot.clone(), Default::default());
|
||||
let snapshot = block_map.read(wraps_snapshot, Default::default());
|
||||
// Same height as before, should remain the same
|
||||
assert_eq!(snapshot.text(), "aaa\n\n\n\n\n\nbbb\nccc\nddd\n\n\n");
|
||||
}
|
||||
|
@ -2360,16 +2360,14 @@ mod tests {
|
|||
buffer.edit([(Point::new(2, 0)..Point::new(3, 0), "")], None, cx);
|
||||
buffer.snapshot(cx)
|
||||
});
|
||||
let (inlay_snapshot, inlay_edits) = inlay_map.sync(
|
||||
buffer_snapshot.clone(),
|
||||
buffer_subscription.consume().into_inner(),
|
||||
);
|
||||
let (inlay_snapshot, inlay_edits) =
|
||||
inlay_map.sync(buffer_snapshot, buffer_subscription.consume().into_inner());
|
||||
let (fold_snapshot, fold_edits) = fold_map.read(inlay_snapshot, inlay_edits);
|
||||
let (tab_snapshot, tab_edits) = tab_map.sync(fold_snapshot, fold_edits, tab_size);
|
||||
let (wraps_snapshot, wrap_edits) = wrap_map.update(cx, |wrap_map, cx| {
|
||||
wrap_map.sync(tab_snapshot, tab_edits, cx)
|
||||
});
|
||||
let blocks_snapshot = block_map.read(wraps_snapshot.clone(), wrap_edits);
|
||||
let blocks_snapshot = block_map.read(wraps_snapshot, wrap_edits);
|
||||
assert_eq!(blocks_snapshot.text(), "line1\n\n\n\n\nline5");
|
||||
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, cx| {
|
||||
|
@ -2454,7 +2452,7 @@ mod tests {
|
|||
// Removing the replace block shows all the hidden blocks again.
|
||||
let mut writer = block_map.write(wraps_snapshot.clone(), Default::default());
|
||||
writer.remove(HashSet::from_iter([replace_block_id]));
|
||||
let blocks_snapshot = block_map.read(wraps_snapshot.clone(), Default::default());
|
||||
let blocks_snapshot = block_map.read(wraps_snapshot, Default::default());
|
||||
assert_eq!(
|
||||
blocks_snapshot.text(),
|
||||
"\nline1\n\nline2\n\n\nline 2.1\nline2.2\nline 2.3\nline 2.4\n\nline4\n\nline5"
|
||||
|
@ -2793,7 +2791,7 @@ mod tests {
|
|||
buffer.read_with(cx, |buffer, cx| {
|
||||
writer.fold_buffers([buffer_id_3], buffer, cx);
|
||||
});
|
||||
let blocks_snapshot = block_map.read(wrap_snapshot.clone(), Patch::default());
|
||||
let blocks_snapshot = block_map.read(wrap_snapshot, Patch::default());
|
||||
let blocks = blocks_snapshot
|
||||
.blocks_in_range(0..u32::MAX)
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -2846,7 +2844,7 @@ mod tests {
|
|||
assert_eq!(buffer_ids.len(), 1);
|
||||
let buffer_id = buffer_ids[0];
|
||||
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
let (_, fold_snapshot) = FoldMap::new(inlay_snapshot);
|
||||
let (_, tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
|
||||
let (_, wrap_snapshot) =
|
||||
|
@ -2860,7 +2858,7 @@ mod tests {
|
|||
buffer.read_with(cx, |buffer, cx| {
|
||||
writer.fold_buffers([buffer_id], buffer, cx);
|
||||
});
|
||||
let blocks_snapshot = block_map.read(wrap_snapshot.clone(), Patch::default());
|
||||
let blocks_snapshot = block_map.read(wrap_snapshot, Patch::default());
|
||||
let blocks = blocks_snapshot
|
||||
.blocks_in_range(0..u32::MAX)
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -3527,7 +3525,7 @@ mod tests {
|
|||
..buffer_snapshot.anchor_after(Point::new(1, 0))],
|
||||
false,
|
||||
);
|
||||
let blocks_snapshot = block_map.read(wraps_snapshot.clone(), Default::default());
|
||||
let blocks_snapshot = block_map.read(wraps_snapshot, Default::default());
|
||||
assert_eq!(blocks_snapshot.text(), "abc\n\ndef\nghi\njkl\nmno");
|
||||
}
|
||||
|
||||
|
|
|
@ -1557,7 +1557,7 @@ mod tests {
|
|||
let buffer = MultiBuffer::build_simple(&sample_text(5, 6, 'a'), cx);
|
||||
let subscription = buffer.update(cx, |buffer, _| buffer.subscribe());
|
||||
let buffer_snapshot = buffer.read(cx).snapshot(cx);
|
||||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
let mut map = FoldMap::new(inlay_snapshot.clone()).0;
|
||||
|
||||
let (mut writer, _, _) = map.write(inlay_snapshot, vec![]);
|
||||
|
@ -1636,7 +1636,7 @@ mod tests {
|
|||
let buffer = MultiBuffer::build_simple("abcdefghijkl", cx);
|
||||
let subscription = buffer.update(cx, |buffer, _| buffer.subscribe());
|
||||
let buffer_snapshot = buffer.read(cx).snapshot(cx);
|
||||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
|
||||
{
|
||||
let mut map = FoldMap::new(inlay_snapshot.clone()).0;
|
||||
|
@ -1712,7 +1712,7 @@ mod tests {
|
|||
let buffer = MultiBuffer::build_simple(&sample_text(5, 6, 'a'), cx);
|
||||
let subscription = buffer.update(cx, |buffer, _| buffer.subscribe());
|
||||
let buffer_snapshot = buffer.read(cx).snapshot(cx);
|
||||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
let mut map = FoldMap::new(inlay_snapshot.clone()).0;
|
||||
|
||||
let (mut writer, _, _) = map.write(inlay_snapshot.clone(), vec![]);
|
||||
|
@ -1720,7 +1720,7 @@ mod tests {
|
|||
(Point::new(0, 2)..Point::new(2, 2), FoldPlaceholder::test()),
|
||||
(Point::new(3, 1)..Point::new(4, 1), FoldPlaceholder::test()),
|
||||
]);
|
||||
let (snapshot, _) = map.read(inlay_snapshot.clone(), vec![]);
|
||||
let (snapshot, _) = map.read(inlay_snapshot, vec![]);
|
||||
assert_eq!(snapshot.text(), "aa⋯cccc\nd⋯eeeee");
|
||||
|
||||
let buffer_snapshot = buffer.update(cx, |buffer, cx| {
|
||||
|
@ -1747,7 +1747,7 @@ mod tests {
|
|||
(Point::new(1, 2)..Point::new(3, 2), FoldPlaceholder::test()),
|
||||
(Point::new(3, 1)..Point::new(4, 1), FoldPlaceholder::test()),
|
||||
]);
|
||||
let (snapshot, _) = map.read(inlay_snapshot.clone(), vec![]);
|
||||
let (snapshot, _) = map.read(inlay_snapshot, vec![]);
|
||||
let fold_ranges = snapshot
|
||||
.folds_in_range(Point::new(1, 0)..Point::new(1, 3))
|
||||
.map(|fold| {
|
||||
|
@ -1782,7 +1782,7 @@ mod tests {
|
|||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let mut map = FoldMap::new(inlay_snapshot.clone()).0;
|
||||
|
||||
let (mut initial_snapshot, _) = map.read(inlay_snapshot.clone(), vec![]);
|
||||
let (mut initial_snapshot, _) = map.read(inlay_snapshot, vec![]);
|
||||
let mut snapshot_edits = Vec::new();
|
||||
|
||||
let mut next_inlay_id = 0;
|
||||
|
|
|
@ -116,7 +116,7 @@ impl TabMap {
|
|||
state.new.end = edit.new.end;
|
||||
Some(None) // Skip this edit, it's merged
|
||||
} else {
|
||||
let new_state = edit.clone();
|
||||
let new_state = edit;
|
||||
let result = Some(Some(state.clone())); // Yield the previous edit
|
||||
**state = new_state;
|
||||
result
|
||||
|
@ -611,7 +611,7 @@ mod tests {
|
|||
fn test_expand_tabs(cx: &mut gpui::App) {
|
||||
let buffer = MultiBuffer::build_simple("", cx);
|
||||
let buffer_snapshot = buffer.read(cx).snapshot(cx);
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
let (_, fold_snapshot) = FoldMap::new(inlay_snapshot);
|
||||
let (_, tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
|
||||
|
||||
|
@ -628,7 +628,7 @@ mod tests {
|
|||
|
||||
let buffer = MultiBuffer::build_simple(input, cx);
|
||||
let buffer_snapshot = buffer.read(cx).snapshot(cx);
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
let (_, fold_snapshot) = FoldMap::new(inlay_snapshot);
|
||||
let (_, mut tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
|
||||
|
||||
|
@ -675,7 +675,7 @@ mod tests {
|
|||
|
||||
let buffer = MultiBuffer::build_simple(input, cx);
|
||||
let buffer_snapshot = buffer.read(cx).snapshot(cx);
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
let (_, fold_snapshot) = FoldMap::new(inlay_snapshot);
|
||||
let (_, mut tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
|
||||
|
||||
|
@ -689,7 +689,7 @@ mod tests {
|
|||
|
||||
let buffer = MultiBuffer::build_simple(input, cx);
|
||||
let buffer_snapshot = buffer.read(cx).snapshot(cx);
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (_, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
let (_, fold_snapshot) = FoldMap::new(inlay_snapshot);
|
||||
let (_, tab_snapshot) = TabMap::new(fold_snapshot, 4.try_into().unwrap());
|
||||
|
||||
|
@ -749,7 +749,7 @@ mod tests {
|
|||
let buffer_snapshot = buffer.read(cx).snapshot(cx);
|
||||
log::info!("Buffer text: {:?}", buffer_snapshot.text());
|
||||
|
||||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot.clone());
|
||||
let (mut inlay_map, inlay_snapshot) = InlayMap::new(buffer_snapshot);
|
||||
log::info!("InlayMap text: {:?}", inlay_snapshot.text());
|
||||
let (mut fold_map, _) = FoldMap::new(inlay_snapshot.clone());
|
||||
fold_map.randomly_mutate(&mut rng);
|
||||
|
@ -758,7 +758,7 @@ mod tests {
|
|||
let (inlay_snapshot, _) = inlay_map.randomly_mutate(&mut 0, &mut rng);
|
||||
log::info!("InlayMap text: {:?}", inlay_snapshot.text());
|
||||
|
||||
let (mut tab_map, _) = TabMap::new(fold_snapshot.clone(), tab_size);
|
||||
let (mut tab_map, _) = TabMap::new(fold_snapshot, tab_size);
|
||||
let tabs_snapshot = tab_map.set_max_expansion_column(32);
|
||||
|
||||
let text = text::Rope::from(tabs_snapshot.text().as_str());
|
||||
|
|
|
@ -4528,7 +4528,7 @@ impl Editor {
|
|||
let mut char_position = 0u32;
|
||||
let mut end_tag_offset = None;
|
||||
|
||||
'outer: for chunk in snapshot.text_for_range(range.clone()) {
|
||||
'outer: for chunk in snapshot.text_for_range(range) {
|
||||
if let Some(byte_pos) = chunk.find(&**end_tag) {
|
||||
let chars_before_match =
|
||||
chunk[..byte_pos].chars().count() as u32;
|
||||
|
@ -4881,7 +4881,7 @@ impl Editor {
|
|||
let multibuffer = self.buffer.read(cx);
|
||||
let Some(buffer) = position
|
||||
.buffer_id
|
||||
.and_then(|buffer_id| multibuffer.buffer(buffer_id).clone())
|
||||
.and_then(|buffer_id| multibuffer.buffer(buffer_id))
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
|
@ -6269,7 +6269,7 @@ impl Editor {
|
|||
}))
|
||||
}
|
||||
CodeActionsItem::DebugScenario(scenario) => {
|
||||
let context = actions_menu.actions.context.clone();
|
||||
let context = actions_menu.actions.context;
|
||||
|
||||
workspace.update(cx, |workspace, cx| {
|
||||
dap::send_telemetry(&scenario, TelemetrySpawnLocation::Gutter, cx);
|
||||
|
@ -6469,7 +6469,7 @@ impl Editor {
|
|||
|
||||
fn refresh_code_actions(&mut self, window: &mut Window, cx: &mut Context<Self>) -> Option<()> {
|
||||
let newest_selection = self.selections.newest_anchor().clone();
|
||||
let newest_selection_adjusted = self.selections.newest_adjusted(cx).clone();
|
||||
let newest_selection_adjusted = self.selections.newest_adjusted(cx);
|
||||
let buffer = self.buffer.read(cx);
|
||||
if newest_selection.head().diff_base_anchor.is_some() {
|
||||
return None;
|
||||
|
@ -8188,8 +8188,6 @@ impl Editor {
|
|||
.icon_color(color)
|
||||
.style(ButtonStyle::Transparent)
|
||||
.on_click(cx.listener({
|
||||
let breakpoint = breakpoint.clone();
|
||||
|
||||
move |editor, event: &ClickEvent, window, cx| {
|
||||
let edit_action = if event.modifiers().platform || breakpoint.is_disabled() {
|
||||
BreakpointEditAction::InvertState
|
||||
|
@ -14837,7 +14835,7 @@ impl Editor {
|
|||
if parent == child {
|
||||
return None;
|
||||
}
|
||||
let text = buffer.text_for_range(child.clone()).collect::<String>();
|
||||
let text = buffer.text_for_range(child).collect::<String>();
|
||||
Some((selection.id, parent, text))
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
@ -15940,7 +15938,7 @@ impl Editor {
|
|||
if !split
|
||||
&& Some(&target.buffer) == editor.buffer.read(cx).as_singleton().as_ref()
|
||||
{
|
||||
editor.go_to_singleton_buffer_range(range.clone(), window, cx);
|
||||
editor.go_to_singleton_buffer_range(range, window, cx);
|
||||
} else {
|
||||
window.defer(cx, move |window, cx| {
|
||||
let target_editor: Entity<Self> =
|
||||
|
@ -16198,14 +16196,14 @@ impl Editor {
|
|||
let item_id = item.item_id();
|
||||
|
||||
if split {
|
||||
workspace.split_item(SplitDirection::Right, item.clone(), window, cx);
|
||||
workspace.split_item(SplitDirection::Right, item, window, cx);
|
||||
} else if PreviewTabsSettings::get_global(cx).enable_preview_from_code_navigation {
|
||||
let (preview_item_id, preview_item_idx) =
|
||||
workspace.active_pane().read_with(cx, |pane, _| {
|
||||
(pane.preview_item_id(), pane.preview_item_idx())
|
||||
});
|
||||
|
||||
workspace.add_item_to_active_pane(item.clone(), preview_item_idx, true, window, cx);
|
||||
workspace.add_item_to_active_pane(item, preview_item_idx, true, window, cx);
|
||||
|
||||
if let Some(preview_item_id) = preview_item_id {
|
||||
workspace.active_pane().update(cx, |pane, cx| {
|
||||
|
@ -16213,7 +16211,7 @@ impl Editor {
|
|||
});
|
||||
}
|
||||
} else {
|
||||
workspace.add_item_to_active_pane(item.clone(), None, true, window, cx);
|
||||
workspace.add_item_to_active_pane(item, None, true, window, cx);
|
||||
}
|
||||
workspace.active_pane().update(cx, |pane, cx| {
|
||||
pane.set_preview_item_id(Some(item_id), cx);
|
||||
|
@ -19004,10 +19002,7 @@ impl Editor {
|
|||
|
||||
let selection = text::ToPoint::to_point(&range.start, buffer).row
|
||||
..text::ToPoint::to_point(&range.end, buffer).row;
|
||||
Some((
|
||||
multi_buffer.buffer(buffer.remote_id()).unwrap().clone(),
|
||||
selection,
|
||||
))
|
||||
Some((multi_buffer.buffer(buffer.remote_id()).unwrap(), selection))
|
||||
});
|
||||
|
||||
let Some((buffer, selection)) = buffer_and_selection else {
|
||||
|
@ -19249,7 +19244,7 @@ impl Editor {
|
|||
row_highlights.insert(
|
||||
ix,
|
||||
RowHighlight {
|
||||
range: range.clone(),
|
||||
range,
|
||||
index,
|
||||
color,
|
||||
options,
|
||||
|
@ -21676,7 +21671,7 @@ fn wrap_with_prefix(
|
|||
let subsequent_lines_prefix_len =
|
||||
char_len_with_expanded_tabs(0, &subsequent_lines_prefix, tab_size);
|
||||
let mut wrapped_text = String::new();
|
||||
let mut current_line = first_line_prefix.clone();
|
||||
let mut current_line = first_line_prefix;
|
||||
let mut is_first_line = true;
|
||||
|
||||
let tokenizer = WordBreakingTokenizer::new(&unwrapped_text);
|
||||
|
|
|
@ -88,7 +88,7 @@ impl RenderOnce for BufferFontFamilyControl {
|
|||
.child(Icon::new(IconName::Font))
|
||||
.child(DropdownMenu::new(
|
||||
"buffer-font-family",
|
||||
value.clone(),
|
||||
value,
|
||||
ContextMenu::build(window, cx, |mut menu, _, cx| {
|
||||
let font_family_cache = FontFamilyCache::global(cx);
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue