chore: Fix several style lints (#17488)

It's not comprehensive enough to start linting on `style` group, but
hey, it's a start.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz
2024-09-06 11:58:39 +02:00
committed by GitHub
parent 93249fc82b
commit e6c1c51b37
361 changed files with 3529 additions and 3586 deletions
@@ -58,7 +58,7 @@ pub struct AnthropicLanguageModelProvider {
state: gpui::Model<State>,
}
const ANTHROPIC_API_KEY_VAR: &'static str = "ANTHROPIC_API_KEY";
const ANTHROPIC_API_KEY_VAR: &str = "ANTHROPIC_API_KEY";
pub struct State {
api_key: Option<String>,
+3 -3
View File
@@ -48,7 +48,7 @@ fn zed_cloud_provider_additional_models() -> &'static [AvailableModel] {
static ADDITIONAL_MODELS: LazyLock<Vec<AvailableModel>> = LazyLock::new(|| {
ZED_CLOUD_PROVIDER_ADDITIONAL_MODELS_JSON
.map(|json| serde_json::from_str(json).unwrap())
.unwrap_or(Vec::new())
.unwrap_or_default()
});
ADDITIONAL_MODELS.as_slice()
}
@@ -777,12 +777,12 @@ impl LlmApiToken {
if let Some(token) = lock.as_ref() {
Ok(token.to_string())
} else {
Self::fetch(RwLockUpgradableReadGuard::upgrade(lock).await, &client).await
Self::fetch(RwLockUpgradableReadGuard::upgrade(lock).await, client).await
}
}
async fn refresh(&self, client: &Arc<Client>) -> Result<String> {
Self::fetch(self.0.write().await, &client).await
Self::fetch(self.0.write().await, client).await
}
async fn fetch<'a>(
+1 -1
View File
@@ -51,7 +51,7 @@ pub struct State {
_subscription: Subscription,
}
const GOOGLE_AI_API_KEY_VAR: &'static str = "GOOGLE_AI_API_KEY";
const GOOGLE_AI_API_KEY_VAR: &str = "GOOGLE_AI_API_KEY";
impl State {
fn is_authenticated(&self) -> bool {
@@ -55,7 +55,7 @@ pub struct State {
_subscription: Subscription,
}
const OPENAI_API_KEY_VAR: &'static str = "OPENAI_API_KEY";
const OPENAI_API_KEY_VAR: &str = "OPENAI_API_KEY";
impl State {
fn is_authenticated(&self) -> bool {
+1 -1
View File
@@ -176,7 +176,7 @@ impl LanguageModelRegistry {
model_id: &LanguageModelId,
cx: &mut ModelContext<Self>,
) {
let Some(provider) = self.provider(&provider) else {
let Some(provider) = self.provider(provider) else {
return;
};
+1 -1
View File
@@ -212,7 +212,7 @@ impl LanguageModelRequestMessage {
self.content.is_empty()
|| self
.content
.get(0)
.first()
.map(|content| match content {
MessageContent::Text(text) => text.trim().is_empty(),
MessageContent::ToolResult(tool_result) => {