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
|
@ -104,7 +104,7 @@ fn register_language_model_providers(
|
|||
cx: &mut Context<LanguageModelRegistry>,
|
||||
) {
|
||||
registry.register_provider(
|
||||
CloudLanguageModelProvider::new(user_store.clone(), client.clone(), cx),
|
||||
CloudLanguageModelProvider::new(user_store, client.clone(), cx),
|
||||
cx,
|
||||
);
|
||||
|
||||
|
|
|
@ -917,7 +917,7 @@ pub fn map_to_language_model_completion_events(
|
|||
Some(ContentBlockDelta::ReasoningContent(thinking)) => match thinking {
|
||||
ReasoningContentBlockDelta::Text(thoughts) => {
|
||||
Some(Ok(LanguageModelCompletionEvent::Thinking {
|
||||
text: thoughts.clone(),
|
||||
text: thoughts,
|
||||
signature: None,
|
||||
}))
|
||||
}
|
||||
|
@ -968,7 +968,7 @@ pub fn map_to_language_model_completion_events(
|
|||
id: tool_use.id.into(),
|
||||
name: tool_use.name.into(),
|
||||
is_input_complete: true,
|
||||
raw_input: tool_use.input_json.clone(),
|
||||
raw_input: tool_use.input_json,
|
||||
input,
|
||||
},
|
||||
))
|
||||
|
@ -1086,21 +1086,18 @@ impl ConfigurationView {
|
|||
.access_key_id_editor
|
||||
.read(cx)
|
||||
.text(cx)
|
||||
.to_string()
|
||||
.trim()
|
||||
.to_string();
|
||||
let secret_access_key = self
|
||||
.secret_access_key_editor
|
||||
.read(cx)
|
||||
.text(cx)
|
||||
.to_string()
|
||||
.trim()
|
||||
.to_string();
|
||||
let session_token = self
|
||||
.session_token_editor
|
||||
.read(cx)
|
||||
.text(cx)
|
||||
.to_string()
|
||||
.trim()
|
||||
.to_string();
|
||||
let session_token = if session_token.is_empty() {
|
||||
|
@ -1108,13 +1105,7 @@ impl ConfigurationView {
|
|||
} else {
|
||||
Some(session_token)
|
||||
};
|
||||
let region = self
|
||||
.region_editor
|
||||
.read(cx)
|
||||
.text(cx)
|
||||
.to_string()
|
||||
.trim()
|
||||
.to_string();
|
||||
let region = self.region_editor.read(cx).text(cx).trim().to_string();
|
||||
let region = if region.is_empty() {
|
||||
"us-east-1".to_string()
|
||||
} else {
|
||||
|
|
|
@ -140,7 +140,7 @@ impl State {
|
|||
Self {
|
||||
client: client.clone(),
|
||||
llm_api_token: LlmApiToken::default(),
|
||||
user_store: user_store.clone(),
|
||||
user_store,
|
||||
status,
|
||||
accept_terms_of_service_task: None,
|
||||
models: Vec::new(),
|
||||
|
@ -307,7 +307,7 @@ impl CloudLanguageModelProvider {
|
|||
|
||||
Self {
|
||||
client,
|
||||
state: state.clone(),
|
||||
state,
|
||||
_maintain_client_status: maintain_client_status,
|
||||
}
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ impl CloudLanguageModelProvider {
|
|||
Arc::new(CloudLanguageModel {
|
||||
id: LanguageModelId(SharedString::from(model.id.0.clone())),
|
||||
model,
|
||||
llm_api_token: llm_api_token.clone(),
|
||||
llm_api_token,
|
||||
client: self.client.clone(),
|
||||
request_limiter: RateLimiter::new(4),
|
||||
})
|
||||
|
|
|
@ -387,7 +387,7 @@ impl LanguageModel for GoogleLanguageModel {
|
|||
cx: &App,
|
||||
) -> BoxFuture<'static, Result<u64>> {
|
||||
let model_id = self.model.request_id().to_string();
|
||||
let request = into_google(request, model_id.clone(), self.model.mode());
|
||||
let request = into_google(request, model_id, self.model.mode());
|
||||
let http_client = self.http_client.clone();
|
||||
let api_key = self.state.read(cx).api_key.clone();
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ impl LanguageModelProvider for LmStudioLanguageModelProvider {
|
|||
.map(|model| {
|
||||
Arc::new(LmStudioLanguageModel {
|
||||
id: LanguageModelId::from(model.name.clone()),
|
||||
model: model.clone(),
|
||||
model,
|
||||
http_client: self.http_client.clone(),
|
||||
request_limiter: RateLimiter::new(4),
|
||||
}) as Arc<dyn LanguageModel>
|
||||
|
|
|
@ -237,7 +237,7 @@ impl LanguageModelProvider for OllamaLanguageModelProvider {
|
|||
.map(|model| {
|
||||
Arc::new(OllamaLanguageModel {
|
||||
id: LanguageModelId::from(model.name.clone()),
|
||||
model: model.clone(),
|
||||
model,
|
||||
http_client: self.http_client.clone(),
|
||||
request_limiter: RateLimiter::new(4),
|
||||
}) as Arc<dyn LanguageModel>
|
||||
|
|
|
@ -37,7 +37,7 @@ impl IntoElement for InstructionListItem {
|
|||
let item_content = if let (Some(button_label), Some(button_link)) =
|
||||
(self.button_label, self.button_link)
|
||||
{
|
||||
let link = button_link.clone();
|
||||
let link = button_link;
|
||||
let unique_id = SharedString::from(format!("{}-button", self.label));
|
||||
|
||||
h_flex()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue