chore: Bump Rust edition to 2024 (#27800)

Follow-up to https://github.com/zed-industries/zed/pull/27791

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2025-03-31 20:55:27 +02:00 committed by GitHub
parent d50905e000
commit dc64ec9cc8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
802 changed files with 3775 additions and 3662 deletions

View file

@ -1,12 +1,12 @@
use crate::ui::InstructionListItem;
use crate::AllLanguageModelSettings;
use crate::ui::InstructionListItem;
use anthropic::{AnthropicError, AnthropicModelMode, ContentDelta, Event, ResponseContent, Usage};
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use collections::{BTreeMap, HashMap};
use credentials_provider::CredentialsProvider;
use editor::{Editor, EditorElement, EditorStyle};
use futures::Stream;
use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt, TryStreamExt as _};
use futures::{FutureExt, StreamExt, TryStreamExt as _, future::BoxFuture, stream::BoxStream};
use gpui::{
AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace,
};
@ -25,8 +25,8 @@ use std::str::FromStr;
use std::sync::Arc;
use strum::IntoEnumIterator;
use theme::ThemeSettings;
use ui::{prelude::*, Icon, IconName, List, Tooltip};
use util::{maybe, ResultExt};
use ui::{Icon, IconName, List, Tooltip, prelude::*};
use util::{ResultExt, maybe};
const PROVIDER_ID: &str = language_model::ANTHROPIC_PROVIDER_ID;
const PROVIDER_NAME: &str = "Anthropic";

View file

@ -3,9 +3,9 @@ use std::str::FromStr;
use std::sync::Arc;
use crate::ui::InstructionListItem;
use anyhow::{anyhow, Context as _, Result};
use aws_config::stalled_stream_protection::StalledStreamProtectionConfig;
use anyhow::{Context as _, Result, anyhow};
use aws_config::Region;
use aws_config::stalled_stream_protection::StalledStreamProtectionConfig;
use aws_credential_types::Credentials;
use aws_http_client::AwsHttpClient;
use bedrock::bedrock_client::types::{
@ -13,13 +13,14 @@ use bedrock::bedrock_client::types::{
};
use bedrock::bedrock_client::{self, Config};
use bedrock::{
value_to_aws_document, BedrockError, BedrockInnerContent, BedrockMessage, BedrockSpecificTool,
BedrockError, BedrockInnerContent, BedrockMessage, BedrockSpecificTool,
BedrockStreamingResponse, BedrockTool, BedrockToolChoice, BedrockToolInputSchema, Model,
value_to_aws_document,
};
use collections::{BTreeMap, HashMap};
use credentials_provider::CredentialsProvider;
use editor::{Editor, EditorElement, EditorStyle};
use futures::{future::BoxFuture, stream::BoxStream, FutureExt, Stream, StreamExt};
use futures::{FutureExt, Stream, StreamExt, future::BoxFuture, stream::BoxStream};
use gpui::{
AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace,
};
@ -38,8 +39,8 @@ use settings::{Settings, SettingsStore};
use strum::IntoEnumIterator;
use theme::ThemeSettings;
use tokio::runtime::Handle;
use ui::{prelude::*, Icon, IconName, List, Tooltip};
use util::{maybe, ResultExt};
use ui::{Icon, IconName, List, Tooltip, prelude::*};
use util::{ResultExt, maybe};
use crate::AllLanguageModelSettings;

View file

@ -1,14 +1,14 @@
use anthropic::{AnthropicError, AnthropicModelMode};
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use client::{
zed_urls, Client, PerformCompletionParams, UserStore, EXPIRED_LLM_TOKEN_HEADER_NAME,
MAX_LLM_MONTHLY_SPEND_REACHED_HEADER_NAME,
Client, EXPIRED_LLM_TOKEN_HEADER_NAME, MAX_LLM_MONTHLY_SPEND_REACHED_HEADER_NAME,
PerformCompletionParams, UserStore, zed_urls,
};
use collections::BTreeMap;
use feature_flags::{FeatureFlagAppExt, LlmClosedBeta, ZedPro};
use futures::{
future::BoxFuture, stream::BoxStream, AsyncBufReadExt, FutureExt, Stream, StreamExt,
TryStreamExt as _,
AsyncBufReadExt, FutureExt, Stream, StreamExt, TryStreamExt as _, future::BoxFuture,
stream::BoxStream,
};
use gpui::{AnyElement, AnyView, App, AsyncApp, Context, Entity, Subscription, Task};
use http_client::{AsyncBody, HttpClient, Method, Response, StatusCode};
@ -23,25 +23,25 @@ use language_model::{
MaxMonthlySpendReachedError, PaymentRequiredError, RefreshLlmTokenListener,
};
use schemars::JsonSchema;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use serde::{Deserialize, Serialize, de::DeserializeOwned};
use serde_json::value::RawValue;
use settings::{Settings, SettingsStore};
use smol::io::{AsyncReadExt, BufReader};
use smol::Timer;
use smol::io::{AsyncReadExt, BufReader};
use std::{
future,
sync::{Arc, LazyLock},
time::Duration,
};
use strum::IntoEnumIterator;
use ui::{prelude::*, TintColor};
use ui::{TintColor, prelude::*};
use crate::AllLanguageModelSettings;
use crate::provider::anthropic::{
count_anthropic_tokens, into_anthropic, map_to_language_model_completion_events,
};
use crate::provider::google::into_google;
use crate::provider::open_ai::{count_open_ai_tokens, into_open_ai};
use crate::AllLanguageModelSettings;
pub const PROVIDER_NAME: &str = "Zed";

View file

@ -1,7 +1,7 @@
use std::future;
use std::sync::Arc;
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use copilot::copilot_chat::{
ChatMessage, CopilotChat, Model as CopilotChatModel, Request as CopilotChatRequest,
Role as CopilotChatRole,
@ -11,8 +11,8 @@ use futures::future::BoxFuture;
use futures::stream::BoxStream;
use futures::{FutureExt, StreamExt};
use gpui::{
percentage, svg, Action, Animation, AnimationExt, AnyView, App, AsyncApp, Entity, Render,
Subscription, Task, Transformation,
Action, Animation, AnimationExt, AnyView, App, AsyncApp, Entity, Render, Subscription, Task,
Transformation, percentage, svg,
};
use language_model::{
AuthenticateError, LanguageModel, LanguageModelCompletionEvent, LanguageModelId,

View file

@ -1,8 +1,8 @@
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use collections::BTreeMap;
use credentials_provider::CredentialsProvider;
use editor::{Editor, EditorElement, EditorStyle};
use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt};
use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream};
use gpui::{
AnyView, AppContext as _, AsyncApp, Entity, FontStyle, Subscription, Task, TextStyle,
WhiteSpace,
@ -18,10 +18,10 @@ use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsStore};
use std::sync::Arc;
use theme::ThemeSettings;
use ui::{prelude::*, Icon, IconName, List};
use ui::{Icon, IconName, List, prelude::*};
use util::ResultExt;
use crate::{ui::InstructionListItem, AllLanguageModelSettings};
use crate::{AllLanguageModelSettings, ui::InstructionListItem};
const PROVIDER_ID: &str = "deepseek";
const PROVIDER_NAME: &str = "DeepSeek";

View file

@ -1,8 +1,8 @@
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use collections::BTreeMap;
use credentials_provider::CredentialsProvider;
use editor::{Editor, EditorElement, EditorStyle};
use futures::{future::BoxFuture, FutureExt, Stream, StreamExt};
use futures::{FutureExt, Stream, StreamExt, future::BoxFuture};
use google_ai::{FunctionDeclaration, GenerateContentResponse, Part, UsageMetadata};
use gpui::{
AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace,
@ -24,11 +24,11 @@ use std::pin::Pin;
use std::sync::Arc;
use strum::IntoEnumIterator;
use theme::ThemeSettings;
use ui::{prelude::*, Icon, IconName, List, Tooltip};
use ui::{Icon, IconName, List, Tooltip, prelude::*};
use util::ResultExt;
use crate::ui::InstructionListItem;
use crate::AllLanguageModelSettings;
use crate::ui::InstructionListItem;
const PROVIDER_ID: &str = "google";
const PROVIDER_NAME: &str = "Google AI";

View file

@ -1,5 +1,5 @@
use anyhow::{anyhow, Result};
use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt};
use anyhow::{Result, anyhow};
use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream};
use gpui::{AnyView, App, AsyncApp, Context, Subscription, Task};
use http_client::HttpClient;
use language_model::{AuthenticateError, LanguageModelCompletionEvent};
@ -9,14 +9,14 @@ use language_model::{
LanguageModelRequest, RateLimiter, Role,
};
use lmstudio::{
get_models, preload_model, stream_chat_completion, ChatCompletionRequest, ChatMessage,
ModelType,
ChatCompletionRequest, ChatMessage, ModelType, get_models, preload_model,
stream_chat_completion,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsStore};
use std::{collections::BTreeMap, sync::Arc};
use ui::{prelude::*, ButtonLike, Indicator};
use ui::{ButtonLike, Indicator, prelude::*};
use util::ResultExt;
use crate::AllLanguageModelSettings;

View file

@ -1,8 +1,8 @@
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use collections::BTreeMap;
use credentials_provider::CredentialsProvider;
use editor::{Editor, EditorElement, EditorStyle};
use futures::{future::BoxFuture, FutureExt, StreamExt};
use futures::{FutureExt, StreamExt, future::BoxFuture};
use gpui::{
AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace,
};
@ -20,10 +20,10 @@ use settings::{Settings, SettingsStore};
use std::sync::Arc;
use strum::IntoEnumIterator;
use theme::ThemeSettings;
use ui::{prelude::*, Icon, IconName, List, Tooltip};
use ui::{Icon, IconName, List, Tooltip, prelude::*};
use util::ResultExt;
use crate::{ui::InstructionListItem, AllLanguageModelSettings};
use crate::{AllLanguageModelSettings, ui::InstructionListItem};
const PROVIDER_ID: &str = "mistral";
const PROVIDER_NAME: &str = "Mistral";

View file

@ -1,5 +1,5 @@
use anyhow::{anyhow, bail, Result};
use futures::{future::BoxFuture, stream::BoxStream, FutureExt, StreamExt};
use anyhow::{Result, anyhow, bail};
use futures::{FutureExt, StreamExt, future::BoxFuture, stream::BoxStream};
use gpui::{AnyView, App, AsyncApp, Context, Subscription, Task};
use http_client::HttpClient;
use language_model::{AuthenticateError, LanguageModelCompletionEvent};
@ -9,14 +9,14 @@ use language_model::{
LanguageModelRequest, RateLimiter, Role,
};
use ollama::{
get_models, preload_model, stream_chat_completion, ChatMessage, ChatOptions, ChatRequest,
ChatResponseDelta, KeepAlive, OllamaToolCall,
ChatMessage, ChatOptions, ChatRequest, ChatResponseDelta, KeepAlive, OllamaToolCall,
get_models, preload_model, stream_chat_completion,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsStore};
use std::{collections::BTreeMap, sync::Arc};
use ui::{prelude::*, ButtonLike, Indicator};
use ui::{ButtonLike, Indicator, prelude::*};
use util::ResultExt;
use crate::AllLanguageModelSettings;

View file

@ -1,8 +1,8 @@
use anyhow::{anyhow, Context as _, Result};
use anyhow::{Context as _, Result, anyhow};
use collections::BTreeMap;
use credentials_provider::CredentialsProvider;
use editor::{Editor, EditorElement, EditorStyle};
use futures::{future::BoxFuture, FutureExt, StreamExt};
use futures::{FutureExt, StreamExt, future::BoxFuture};
use gpui::{
AnyView, App, AsyncApp, Context, Entity, FontStyle, Subscription, Task, TextStyle, WhiteSpace,
};
@ -13,7 +13,7 @@ use language_model::{
LanguageModelProviderState, LanguageModelRequest, RateLimiter, Role,
};
use open_ai::{
stream_completion, FunctionDefinition, ResponseStreamEvent, ToolChoice, ToolDefinition,
FunctionDefinition, ResponseStreamEvent, ToolChoice, ToolDefinition, stream_completion,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
@ -21,10 +21,10 @@ use settings::{Settings, SettingsStore};
use std::sync::Arc;
use strum::IntoEnumIterator;
use theme::ThemeSettings;
use ui::{prelude::*, Icon, IconName, List, Tooltip};
use ui::{Icon, IconName, List, Tooltip, prelude::*};
use util::ResultExt;
use crate::{ui::InstructionListItem, AllLanguageModelSettings};
use crate::{AllLanguageModelSettings, ui::InstructionListItem};
const PROVIDER_ID: &str = "openai";
const PROVIDER_NAME: &str = "OpenAI";

View file

@ -6,7 +6,7 @@ use language_model::LanguageModelCacheConfiguration;
use project::Fs;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::{update_settings_file, Settings, SettingsSources};
use settings::{Settings, SettingsSources, update_settings_file};
use crate::provider::{
self,

View file

@ -1,5 +1,5 @@
use gpui::{AnyElement, IntoElement, ParentElement, SharedString};
use ui::{prelude::*, ListItem};
use ui::{ListItem, prelude::*};
/// A reusable list item component for adding LLM provider configuration instructions
pub struct InstructionListItem {