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,18 +1,19 @@
use crate::persistence::model::DockData;
use crate::{status_bar::StatusItemView, Workspace};
use crate::{DraggedDock, Event, ModalLayer, Pane};
use crate::{Workspace, status_bar::StatusItemView};
use anyhow::Context as _;
use client::proto;
use gpui::{
deferred, div, px, Action, AnyView, App, Axis, Context, Corner, Entity, EntityId, EventEmitter,
FocusHandle, Focusable, IntoElement, KeyContext, MouseButton, MouseDownEvent, MouseUpEvent,
ParentElement, Render, SharedString, StyleRefinement, Styled, Subscription, WeakEntity, Window,
Action, AnyView, App, Axis, Context, Corner, Entity, EntityId, EventEmitter, FocusHandle,
Focusable, IntoElement, KeyContext, MouseButton, MouseDownEvent, MouseUpEvent, ParentElement,
Render, SharedString, StyleRefinement, Styled, Subscription, WeakEntity, Window, deferred, div,
px,
};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use settings::SettingsStore;
use std::sync::Arc;
use ui::{h_flex, ContextMenu, Divider, DividerColor, IconButton, Tooltip};
use ui::{ContextMenu, Divider, DividerColor, IconButton, Tooltip, h_flex};
use ui::{prelude::*, right_click_menu};
pub(crate) const RESIZE_HANDLE_SIZE: Pixels = Pixels(6.);
@ -930,7 +931,7 @@ impl StatusItemView for PanelButtons {
#[cfg(any(test, feature = "test-support"))]
pub mod test {
use super::*;
use gpui::{actions, div, App, Context, Window};
use gpui::{App, Context, Window, actions, div};
pub struct TestPanel {
pub position: DockPosition,

View file

@ -1,17 +1,17 @@
use crate::{
DelayedDebouncedEditAction, FollowableViewRegistry, ItemNavHistory, SerializableItemRegistry,
ToolbarItemLocation, ViewId, Workspace, WorkspaceId,
pane::{self, Pane},
persistence::model::ItemId,
searchable::SearchableItemHandle,
workspace_settings::{AutosaveSetting, WorkspaceSettings},
DelayedDebouncedEditAction, FollowableViewRegistry, ItemNavHistory, SerializableItemRegistry,
ToolbarItemLocation, ViewId, Workspace, WorkspaceId,
};
use anyhow::Result;
use client::{
proto::{self, PeerId},
Client,
proto::{self, PeerId},
};
use futures::{channel::mpsc, StreamExt};
use futures::{StreamExt, channel::mpsc};
use gpui::{
Action, AnyElement, AnyView, App, Context, Entity, EntityId, EventEmitter, FocusHandle,
Focusable, Font, HighlightStyle, Pixels, Point, Render, SharedString, Task, WeakEntity, Window,

View file

@ -1,13 +1,13 @@
use crate::{Toast, Workspace};
use gpui::{
svg, AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent,
Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, Render, ScrollHandle, Task,
AnyView, App, AppContext as _, AsyncWindowContext, ClipboardItem, Context, DismissEvent,
Entity, EventEmitter, FocusHandle, Focusable, PromptLevel, Render, ScrollHandle, Task, svg,
};
use parking_lot::Mutex;
use std::ops::Deref;
use std::sync::{Arc, LazyLock};
use std::{any::TypeId, time::Duration};
use ui::{prelude::*, Tooltip};
use ui::{Tooltip, prelude::*};
use util::ResultExt;
#[derive(Default)]
@ -408,8 +408,8 @@ pub mod simple_message_notification {
use std::sync::Arc;
use gpui::{
div, AnyElement, DismissEvent, EventEmitter, FocusHandle, Focusable, ParentElement, Render,
SharedString, Styled,
AnyElement, DismissEvent, EventEmitter, FocusHandle, Focusable, ParentElement, Render,
SharedString, Styled, div,
};
use ui::prelude::*;
@ -770,7 +770,7 @@ pub trait NotifyResultExt {
type Ok;
fn notify_err(self, workspace: &mut Workspace, cx: &mut Context<Workspace>)
-> Option<Self::Ok>;
-> Option<Self::Ok>;
fn notify_async_err(self, cx: &mut AsyncWindowContext) -> Option<Self::Ok>;

View file

@ -1,4 +1,7 @@
use crate::{
CloseWindow, NewFile, NewTerminal, OpenInTerminal, OpenOptions, OpenTerminal, OpenVisible,
SplitDirection, ToggleFileFinder, ToggleProjectSymbols, ToggleZoom, Workspace,
WorkspaceItemBuilder,
item::{
ActivateOnClose, ClosePosition, Item, ItemHandle, ItemSettings, PreviewTabsSettings,
ProjectItemKind, ShowCloseButton, ShowDiagnostics, TabContentParams, TabTooltipContent,
@ -8,19 +11,16 @@ use crate::{
notifications::NotifyResultExt,
toolbar::Toolbar,
workspace_settings::{AutosaveSetting, TabBarSettings, WorkspaceSettings},
CloseWindow, NewFile, NewTerminal, OpenInTerminal, OpenOptions, OpenTerminal, OpenVisible,
SplitDirection, ToggleFileFinder, ToggleProjectSymbols, ToggleZoom, Workspace,
WorkspaceItemBuilder,
};
use anyhow::Result;
use collections::{BTreeSet, HashMap, HashSet, VecDeque};
use futures::{stream::FuturesUnordered, StreamExt};
use futures::{StreamExt, stream::FuturesUnordered};
use gpui::{
actions, anchored, deferred, impl_actions, prelude::*, Action, AnyElement, App,
AsyncWindowContext, ClickEvent, ClipboardItem, Context, Corner, Div, DragMoveEvent, Entity,
EntityId, EventEmitter, ExternalPaths, FocusHandle, FocusOutEvent, Focusable, KeyContext,
MouseButton, MouseDownEvent, NavigationDirection, Pixels, Point, PromptLevel, Render,
ScrollHandle, Subscription, Task, WeakEntity, WeakFocusHandle, Window,
Action, AnyElement, App, AsyncWindowContext, ClickEvent, ClipboardItem, Context, Corner, Div,
DragMoveEvent, Entity, EntityId, EventEmitter, ExternalPaths, FocusHandle, FocusOutEvent,
Focusable, KeyContext, MouseButton, MouseDownEvent, NavigationDirection, Pixels, Point,
PromptLevel, Render, ScrollHandle, Subscription, Task, WeakEntity, WeakFocusHandle, Window,
actions, anchored, deferred, impl_actions, prelude::*,
};
use itertools::Itertools;
use language::DiagnosticSeverity;
@ -36,18 +36,18 @@ use std::{
path::PathBuf,
rc::Rc,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
atomic::{AtomicUsize, Ordering},
},
};
use theme::ThemeSettings;
use ui::{
prelude::*, right_click_menu, ButtonSize, Color, ContextMenu, ContextMenuEntry,
ContextMenuItem, DecoratedIcon, IconButton, IconButtonShape, IconDecoration,
IconDecorationKind, IconName, IconSize, Indicator, Label, PopoverMenu, PopoverMenuHandle, Tab,
TabBar, TabPosition, Tooltip,
ButtonSize, Color, ContextMenu, ContextMenuEntry, ContextMenuItem, DecoratedIcon, IconButton,
IconButtonShape, IconDecoration, IconDecorationKind, IconName, IconSize, Indicator, Label,
PopoverMenu, PopoverMenuHandle, Tab, TabBar, TabPosition, Tooltip, prelude::*,
right_click_menu,
};
use util::{debug_panic, maybe, truncate_and_remove_front, ResultExt};
use util::{ResultExt, debug_panic, maybe, truncate_and_remove_front};
/// A selected entry in e.g. project panel.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
@ -3701,8 +3701,8 @@ mod tests {
let pane = workspace.update(cx, |workspace, _| workspace.active_pane().clone());
pane.update_in(cx, |pane, window, cx| {
assert!(pane
.close_active_item(
assert!(
pane.close_active_item(
&CloseActiveItem {
save_intent: None,
close_pinned: false
@ -3710,7 +3710,8 @@ mod tests {
window,
cx
)
.is_none())
.is_none()
)
});
}

View file

@ -1,15 +1,15 @@
use crate::{
AppState, FollowerState, Pane, Workspace, WorkspaceSettings,
pane_group::element::pane_axis,
workspace_settings::{PaneSplitDirectionHorizontal, PaneSplitDirectionVertical},
AppState, FollowerState, Pane, Workspace, WorkspaceSettings,
};
use anyhow::{anyhow, Result};
use anyhow::{Result, anyhow};
use call::{ActiveCall, ParticipantLocation};
use client::proto::PeerId;
use collections::HashMap;
use gpui::{
point, size, Along, AnyView, AnyWeakView, Axis, Bounds, Context, Entity, IntoElement,
MouseButton, Pixels, Point, StyleRefinement, Window,
Along, AnyView, AnyWeakView, Axis, Bounds, Context, Entity, IntoElement, MouseButton, Pixels,
Point, StyleRefinement, Window, point, size,
};
use parking_lot::Mutex;
use project::Project;
@ -803,9 +803,9 @@ mod element {
use std::{cell::RefCell, iter, rc::Rc, sync::Arc};
use gpui::{
px, relative, size, Along, AnyElement, App, Axis, BorderStyle, Bounds, Element,
GlobalElementId, IntoElement, MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement,
Pixels, Point, Size, Style, WeakEntity, Window,
Along, AnyElement, App, Axis, BorderStyle, Bounds, Element, GlobalElementId, IntoElement,
MouseDownEvent, MouseMoveEvent, MouseUpEvent, ParentElement, Pixels, Point, Size, Style,
WeakEntity, Window, px, relative, size,
};
use gpui::{CursorStyle, Hitbox};
use parking_lot::Mutex;

View file

@ -8,10 +8,10 @@ use std::{
sync::Arc,
};
use anyhow::{anyhow, bail, Context, Result};
use anyhow::{Context, Result, anyhow, bail};
use client::DevServerProjectId;
use db::{define_connection, query, sqlez::connection::Connection, sqlez_macros::sql};
use gpui::{point, size, Axis, Bounds, WindowBounds, WindowId};
use gpui::{Axis, Bounds, WindowBounds, WindowId, point, size};
use itertools::Itertools;
use project::debugger::breakpoint_store::{BreakpointState, SourceBreakpoint};
@ -24,7 +24,7 @@ use sqlez::{
};
use ui::px;
use util::{maybe, ResultExt};
use util::{ResultExt, maybe};
use uuid::Uuid;
use crate::WorkspaceId;
@ -259,7 +259,7 @@ impl sqlez::bindable::Bind for SerializedPixels {
statement: &sqlez::statement::Statement,
start_index: i32,
) -> anyhow::Result<i32> {
let this: i32 = self.0 .0 as i32;
let this: i32 = self.0.0 as i32;
this.bind(statement, start_index)
}
}

View file

@ -1,6 +1,6 @@
use super::{SerializedAxis, SerializedWindowBounds};
use crate::{
item::ItemHandle, Member, Pane, PaneAxis, SerializableItemRegistry, Workspace, WorkspaceId,
Member, Pane, PaneAxis, SerializableItemRegistry, Workspace, WorkspaceId, item::ItemHandle,
};
use anyhow::{Context as _, Result};
use async_recursion::async_recursion;
@ -10,7 +10,7 @@ use db::sqlez::{
};
use gpui::{AsyncWindowContext, Entity, WeakEntity};
use itertools::Itertools as _;
use project::{debugger::breakpoint_store::SourceBreakpoint, Project};
use project::{Project, debugger::breakpoint_store::SourceBreakpoint};
use remote::ssh_session::SshProjectId;
use serde::{Deserialize, Serialize};
use std::{
@ -18,7 +18,7 @@ use std::{
path::{Path, PathBuf},
sync::Arc,
};
use util::{paths::SanitizedPath, ResultExt};
use util::{ResultExt, paths::SanitizedPath};
use uuid::Uuid;
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]

View file

@ -8,8 +8,8 @@ use gpui::{
use project::search::SearchQuery;
use crate::{
item::{Item, WeakItemHandle},
ItemHandle,
item::{Item, WeakItemHandle},
};
#[derive(Clone, Debug)]

View file

@ -1,15 +1,15 @@
use crate::{
item::{Item, ItemEvent},
ItemNavHistory, WorkspaceId,
item::{Item, ItemEvent},
};
use call::{RemoteVideoTrack, RemoteVideoTrackView, Room};
use client::{proto::PeerId, User};
use client::{User, proto::PeerId};
use gpui::{
div, AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement,
ParentElement, Render, SharedString, Styled,
AppContext as _, Entity, EventEmitter, FocusHandle, Focusable, InteractiveElement,
ParentElement, Render, SharedString, Styled, div,
};
use std::sync::Arc;
use ui::{prelude::*, Icon, IconName};
use ui::{Icon, IconName, prelude::*};
pub enum Event {
Close,

View file

@ -1,12 +1,12 @@
#![allow(unused, dead_code)]
use gpui::{actions, hsla, AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Hsla};
use gpui::{AnyElement, App, Entity, EventEmitter, FocusHandle, Focusable, Hsla, actions, hsla};
use strum::IntoEnumIterator;
use theme::all_theme_colors;
use ui::{
element_cell, prelude::*, string_cell, utils::calculate_contrast_ratio, AudioStatus, Avatar,
AvatarAudioStatusIndicator, AvatarAvailabilityIndicator, ButtonLike, Checkbox,
CheckboxWithLabel, CollaboratorAvailability, ContentGroup, DecoratedIcon, ElevationIndex,
Facepile, IconDecoration, Indicator, KeybindingHint, Switch, Table, TintColor, Tooltip,
AudioStatus, Avatar, AvatarAudioStatusIndicator, AvatarAvailabilityIndicator, ButtonLike,
Checkbox, CheckboxWithLabel, CollaboratorAvailability, ContentGroup, DecoratedIcon,
ElevationIndex, Facepile, IconDecoration, Indicator, KeybindingHint, Switch, Table, TintColor,
Tooltip, element_cell, prelude::*, string_cell, utils::calculate_contrast_ratio,
};
use crate::{Item, Workspace};

View file

@ -3,7 +3,7 @@ use std::{
time::{Duration, Instant},
};
use gpui::{actions, AnyView, DismissEvent, Entity, FocusHandle, ManagedView, Subscription, Task};
use gpui::{AnyView, DismissEvent, Entity, FocusHandle, ManagedView, Subscription, Task, actions};
use ui::{animation::DefaultAnimations, prelude::*};
use crate::Workspace;

View file

@ -17,31 +17,31 @@ mod workspace_settings;
use dap::DapRegistry;
pub use toast_layer::{RunAction, ToastAction, ToastLayer, ToastView};
use anyhow::{anyhow, Context as _, Result};
use call::{call_settings::CallSettings, ActiveCall};
use anyhow::{Context as _, Result, anyhow};
use call::{ActiveCall, call_settings::CallSettings};
use client::{
proto::{self, ErrorCode, PanelId, PeerId},
ChannelId, Client, ErrorExt, Status, TypedEnvelope, UserStore,
proto::{self, ErrorCode, PanelId, PeerId},
};
use collections::{hash_map, HashMap, HashSet};
use collections::{HashMap, HashSet, hash_map};
use derive_more::{Deref, DerefMut};
pub use dock::Panel;
use dock::{Dock, DockPosition, PanelButtons, PanelHandle, RESIZE_HANDLE_SIZE};
use futures::{
Future, FutureExt, StreamExt,
channel::{
mpsc::{self, UnboundedReceiver, UnboundedSender},
oneshot,
},
future::try_join_all,
Future, FutureExt, StreamExt,
};
use gpui::{
action_as, actions, canvas, impl_action_as, impl_actions, point, relative, size,
transparent_black, Action, AnyView, AnyWeakView, App, AsyncApp, AsyncWindowContext, Bounds,
Context, CursorStyle, Decorations, DragMoveEvent, Entity, EntityId, EventEmitter, FocusHandle,
Focusable, Global, Hsla, KeyContext, Keystroke, ManagedView, MouseButton, PathPromptOptions,
Point, PromptLevel, Render, ResizeEdge, Size, Stateful, Subscription, Task, Tiling, WeakEntity,
WindowBounds, WindowHandle, WindowId, WindowOptions,
Action, AnyView, AnyWeakView, App, AsyncApp, AsyncWindowContext, Bounds, Context, CursorStyle,
Decorations, DragMoveEvent, Entity, EntityId, EventEmitter, FocusHandle, Focusable, Global,
Hsla, KeyContext, Keystroke, ManagedView, MouseButton, PathPromptOptions, Point, PromptLevel,
Render, ResizeEdge, Size, Stateful, Subscription, Task, Tiling, WeakEntity, WindowBounds,
WindowHandle, WindowId, WindowOptions, action_as, actions, canvas, impl_action_as,
impl_actions, point, relative, size, transparent_black,
};
pub use item::{
FollowableItem, FollowableItemHandle, Item, ItemHandle, ItemSettings, PreviewTabsSettings,
@ -52,24 +52,24 @@ use language::{LanguageRegistry, Rope};
pub use modal_layer::*;
use node_runtime::NodeRuntime;
use notifications::{
simple_message_notification::MessageNotification, DetachAndPromptErr, Notifications,
DetachAndPromptErr, Notifications, simple_message_notification::MessageNotification,
};
pub use pane::*;
pub use pane_group::*;
pub use persistence::{
model::{ItemId, LocalPaths, SerializedWorkspaceLocation},
WorkspaceDb, DB as WORKSPACE_DB,
};
use persistence::{
DB, SerializedWindowBounds,
model::{SerializedSshProject, SerializedWorkspace},
SerializedWindowBounds, DB,
};
pub use persistence::{
DB as WORKSPACE_DB, WorkspaceDb,
model::{ItemId, LocalPaths, SerializedWorkspaceLocation},
};
use postage::stream::Stream;
use project::{
debugger::breakpoint_store::BreakpointStoreEvent, DirectoryLister, Project, ProjectEntryId,
ProjectPath, ResolvedPath, Worktree, WorktreeId,
DirectoryLister, Project, ProjectEntryId, ProjectPath, ResolvedPath, Worktree, WorktreeId,
debugger::breakpoint_store::BreakpointStoreEvent,
};
use remote::{ssh_session::ConnectionIdentifier, SshClientDelegate, SshConnectionOptions};
use remote::{SshClientDelegate, SshConnectionOptions, ssh_session::ConnectionIdentifier};
use schemars::JsonSchema;
use serde::Deserialize;
use session::AppSession;
@ -91,7 +91,7 @@ use std::{
hash::{Hash, Hasher},
path::{Path, PathBuf},
rc::Rc,
sync::{atomic::AtomicUsize, Arc, LazyLock, Weak},
sync::{Arc, LazyLock, Weak, atomic::AtomicUsize},
time::Duration,
};
use task::{DebugAdapterConfig, SpawnInTerminal, TaskId};
@ -99,7 +99,7 @@ use theme::{ActiveTheme, SystemAppearance, ThemeSettings};
pub use toolbar::{Toolbar, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView};
pub use ui;
use ui::prelude::*;
use util::{paths::SanitizedPath, serde::default_true, ResultExt, TryFutureExt};
use util::{ResultExt, TryFutureExt, paths::SanitizedPath, serde::default_true};
use uuid::Uuid;
pub use workspace_settings::{
AutosaveSetting, RestoreOnStartupBehavior, TabBarSettings, WorkspaceSettings,
@ -107,8 +107,8 @@ pub use workspace_settings::{
use crate::notifications::NotificationId;
use crate::persistence::{
model::{DockData, DockStructure, SerializedItem, SerializedPane, SerializedPaneGroup},
SerializedAxis,
model::{DockData, DockStructure, SerializedItem, SerializedPane, SerializedPaneGroup},
};
pub const SERIALIZATION_THROTTLE_TIME: Duration = Duration::from_millis(200);
@ -6918,16 +6918,16 @@ mod tests {
use super::*;
use crate::{
dock::{test::TestPanel, PanelEvent},
dock::{PanelEvent, test::TestPanel},
item::{
test::{TestItem, TestProjectItem},
ItemEvent,
test::{TestItem, TestProjectItem},
},
};
use fs::FakeFs;
use gpui::{
px, DismissEvent, Empty, EventEmitter, FocusHandle, Focusable, Render, TestAppContext,
UpdateGlobal, VisualTestContext,
DismissEvent, Empty, EventEmitter, FocusHandle, Focusable, Render, TestAppContext,
UpdateGlobal, VisualTestContext, px,
};
use project::{Project, ProjectEntryId};
use serde_json::json;