Fix clippy::needless_borrow lint violations (#36444)
Release Notes: - N/A
This commit is contained in:
parent
eecf142f06
commit
9e0e233319
242 changed files with 801 additions and 821 deletions
|
@ -114,7 +114,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.ok();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -133,7 +133,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await
|
||||
.ok();
|
||||
|
||||
|
@ -212,7 +212,7 @@ impl AnthropicLanguageModelProvider {
|
|||
} else {
|
||||
cx.spawn(async move |cx| {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ impl State {
|
|||
let credentials_provider = <dyn CredentialsProvider>::global(cx);
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(AMAZON_AWS_URL, &cx)
|
||||
.delete_credentials(AMAZON_AWS_URL, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -174,7 +174,7 @@ impl State {
|
|||
AMAZON_AWS_URL,
|
||||
"Bearer",
|
||||
&serde_json::to_vec(&credentials)?,
|
||||
&cx,
|
||||
cx,
|
||||
)
|
||||
.await?;
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -206,7 +206,7 @@ impl State {
|
|||
(credentials, true)
|
||||
} else {
|
||||
let (_, credentials) = credentials_provider
|
||||
.read_credentials(AMAZON_AWS_URL, &cx)
|
||||
.read_credentials(AMAZON_AWS_URL, cx)
|
||||
.await?
|
||||
.ok_or_else(|| AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
@ -465,7 +465,7 @@ impl BedrockModel {
|
|||
Result<BoxStream<'static, Result<BedrockStreamingResponse, BedrockError>>>,
|
||||
> {
|
||||
let Ok(runtime_client) = self
|
||||
.get_or_init_client(&cx)
|
||||
.get_or_init_client(cx)
|
||||
.cloned()
|
||||
.context("Bedrock client not initialized")
|
||||
else {
|
||||
|
|
|
@ -193,7 +193,7 @@ impl State {
|
|||
fn authenticate(&self, cx: &mut Context<Self>) -> Task<Result<()>> {
|
||||
let client = self.client.clone();
|
||||
cx.spawn(async move |state, cx| {
|
||||
client.sign_in_with_optional_connect(true, &cx).await?;
|
||||
client.sign_in_with_optional_connect(true, cx).await?;
|
||||
state.update(cx, |_, cx| cx.notify())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -96,7 +96,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await?;
|
||||
this.update(cx, |this, cx| {
|
||||
this.api_key = Some(api_key);
|
||||
|
@ -120,7 +120,7 @@ impl State {
|
|||
(api_key, true)
|
||||
} else {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
|
|
@ -110,7 +110,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -129,7 +129,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await?;
|
||||
this.update(cx, |this, cx| {
|
||||
this.api_key = Some(api_key);
|
||||
|
@ -156,7 +156,7 @@ impl State {
|
|||
(api_key, true)
|
||||
} else {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
|
|
@ -76,7 +76,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -95,7 +95,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await?;
|
||||
this.update(cx, |this, cx| {
|
||||
this.api_key = Some(api_key);
|
||||
|
@ -119,7 +119,7 @@ impl State {
|
|||
(api_key, true)
|
||||
} else {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
|
|
@ -75,7 +75,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -94,7 +94,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -119,7 +119,7 @@ impl State {
|
|||
(api_key, true)
|
||||
} else {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
|
|
@ -87,7 +87,7 @@ impl State {
|
|||
let api_url = self.settings.api_url.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -103,7 +103,7 @@ impl State {
|
|||
let api_url = self.settings.api_url.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -126,7 +126,7 @@ impl State {
|
|||
(api_key, true)
|
||||
} else {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
|
|
@ -112,7 +112,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -131,7 +131,7 @@ impl State {
|
|||
.clone();
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -157,7 +157,7 @@ impl State {
|
|||
(api_key, true)
|
||||
} else {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
|
|
@ -71,7 +71,7 @@ impl State {
|
|||
};
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -92,7 +92,7 @@ impl State {
|
|||
};
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -119,7 +119,7 @@ impl State {
|
|||
(api_key, true)
|
||||
} else {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
|
|
@ -71,7 +71,7 @@ impl State {
|
|||
};
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.delete_credentials(&api_url, &cx)
|
||||
.delete_credentials(&api_url, cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -92,7 +92,7 @@ impl State {
|
|||
};
|
||||
cx.spawn(async move |this, cx| {
|
||||
credentials_provider
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), &cx)
|
||||
.write_credentials(&api_url, "Bearer", api_key.as_bytes(), cx)
|
||||
.await
|
||||
.log_err();
|
||||
this.update(cx, |this, cx| {
|
||||
|
@ -119,7 +119,7 @@ impl State {
|
|||
(api_key, true)
|
||||
} else {
|
||||
let (_, api_key) = credentials_provider
|
||||
.read_credentials(&api_url, &cx)
|
||||
.read_credentials(&api_url, cx)
|
||||
.await?
|
||||
.ok_or(AuthenticateError::CredentialsNotFound)?;
|
||||
(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue