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
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue