History

Use Fx* variants of HashMap and HashSet everywhere in Zed (#7481)

Release Notes: - N/A

Kirill Bulatov committed 2 years ago

Commit eb236301 parent 793967327 files · +96 −102Browse files

Unified · Split

27 files
  1. Cargo.lock +4 −0
  2. crates/channel/src/channel_chat.rs +1 −1
  3. crates/client/src/client.rs +1 −1
  4. crates/gpui/src/app.rs +13 −13
  5. crates/gpui/src/key_dispatch.rs +7 −7
  6. crates/gpui/src/keymap.rs +2 −5
  7. crates/gpui/src/platform/mac/metal_atlas.rs +2 −2
  8. crates/gpui/src/scene.rs +2 −2
  9. crates/gpui/src/taffy.rs +11 −11
  10. crates/gpui/src/text_system.rs +6 −6
  11. crates/gpui/src/text_system/line_layout.rs +6 −6
  12. crates/gpui/src/window.rs +3 −3
  13. crates/gpui/src/window/element_cx.rs +11 −11
  14. crates/project_panel/src/project_panel.rs +5 −13
  15. crates/search/src/project_search.rs +2 −2
  16. crates/semantic_index/src/parsing.rs +2 −2
  17. crates/sqlez/Cargo.toml +1 −0
  18. crates/sqlez/src/thread_safe_connection.rs +2 −1
  19. crates/terminal/Cargo.toml +1 −0
  20. crates/terminal/src/terminal.rs +1 −1
  21. crates/terminal/src/terminal_settings.rs +2 −1
  22. crates/theme/Cargo.toml +2 −5
  23. crates/theme/src/registry.rs +2 −2
  24. crates/util/Cargo.toml +1 −0
  25. crates/util/src/test/marked_text.rs +2 −1
  26. crates/zed/src/open_listener.rs +2 −2
  27. crates/zed/src/zed.rs +2 −4
Cargo.lock+4−0
@@ -7530,6 +7530,7 @@ name = "sqlez" · 7529 unmodified lines
7530version = "0.1.0"7530version = "0.1.0"
7531dependencies = [7531dependencies = [
7532 "anyhow",7532 "anyhow",
7533 "collections",
7533 "futures 0.3.28",7534 "futures 0.3.28",
7534 "indoc",7535 "indoc",
7535 "lazy_static",7536 "lazy_static",
@@ -8105,6 +8106,7 @@ version = "0.1.0" · 569 unmodified lines
8105dependencies = [8106dependencies = [
8106 "alacritty_terminal",8107 "alacritty_terminal",
8107 "anyhow",8108 "anyhow",
8109 "collections",
8108 "db",8110 "db",
8109 "dirs 4.0.0",8111 "dirs 4.0.0",
8110 "futures 0.3.28",8112 "futures 0.3.28",
@@ -8200,6 +8202,7 @@ name = "theme" · 89 unmodified lines
8200version = "0.1.0"8202version = "0.1.0"
8201dependencies = [8203dependencies = [
8202 "anyhow",8204 "anyhow",
8205 "collections",
8203 "color",8206 "color",
8204 "derive_more",8207 "derive_more",
8205 "fs",8208 "fs",
@@ -9343,6 +9346,7 @@ version = "0.1.0" · 1137 unmodified lines
9343dependencies = [9346dependencies = [
9344 "anyhow",9347 "anyhow",
9345 "backtrace",9348 "backtrace",
9349 "collections",
9346 "dirs 3.0.2",9350 "dirs 3.0.2",
9347 "futures 0.3.28",9351 "futures 0.3.28",
9348 "git2",9352 "git2",
crates/channel/src/channel_chat.rs+1−1
@@ -5,13 +5,13 @@ use client::{ · 4 unmodified lines
5 user::{User, UserStore},5 user::{User, UserStore},
6 Client, Subscription, TypedEnvelope, UserId,6 Client, Subscription, TypedEnvelope, UserId,
7};7};
8use collections::HashSet;
8use futures::lock::Mutex;9use futures::lock::Mutex;
9use gpui::{10use gpui::{
10 AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Task, WeakModel,11 AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Task, WeakModel,
11};12};
12use rand::prelude::*;13use rand::prelude::*;
13use std::{14use std::{
14 collections::HashSet,
15 ops::{ControlFlow, Range},15 ops::{ControlFlow, Range},
16 sync::Arc,16 sync::Arc,
17};17};
crates/client/src/client.rs+1−1
@@ -10,6 +10,7 @@ use async_tungstenite::tungstenite::{ · 9 unmodified lines
10 error::Error as WebsocketError,10 error::Error as WebsocketError,
11 http::{Request, StatusCode},11 http::{Request, StatusCode},
12};12};
13use collections::HashMap;
13use futures::{14use futures::{
14 channel::oneshot, future::LocalBoxFuture, AsyncReadExt, FutureExt, SinkExt, StreamExt,15 channel::oneshot, future::LocalBoxFuture, AsyncReadExt, FutureExt, SinkExt, StreamExt,
15 TryFutureExt as _, TryStreamExt,16 TryFutureExt as _, TryStreamExt,
@@ -29,7 +30,6 @@ use serde_json; · 13 unmodified lines
29use settings::{Settings, SettingsStore};30use settings::{Settings, SettingsStore};
30use std::{31use std::{
31 any::TypeId,32 any::TypeId,
32 collections::HashMap,
33 convert::TryFrom,33 convert::TryFrom,
34 fmt::Write as _,34 fmt::Write as _,
35 future::Future,35 future::Future,
crates/gpui/src/app.rs+13−13
@@ -23,7 +23,7 @@ use crate::{ · 22 unmodified lines
23 TextSystem, View, ViewContext, Window, WindowContext, WindowHandle, WindowId,23 TextSystem, View, ViewContext, Window, WindowContext, WindowHandle, WindowId,
24};24};
25use anyhow::{anyhow, Result};25use anyhow::{anyhow, Result};
26use collections::{FxHashMap, FxHashSet, VecDeque};26use collections::{HashMap, HashSet, VecDeque};
27use futures::{channel::oneshot, future::LocalBoxFuture, Future};27use futures::{channel::oneshot, future::LocalBoxFuture, Future};
28 28
29use slotmap::SlotMap;29use slotmap::SlotMap;
@@ -212,24 +212,24 @@ pub struct AppContext { · 182 unmodified lines
212 pending_updates: usize,212 pending_updates: usize,
213 pub(crate) actions: Rc<ActionRegistry>,213 pub(crate) actions: Rc<ActionRegistry>,
214 pub(crate) active_drag: Option<AnyDrag>,214 pub(crate) active_drag: Option<AnyDrag>,
215 pub(crate) next_frame_callbacks: FxHashMap<DisplayId, Vec<FrameCallback>>,215 pub(crate) next_frame_callbacks: HashMap<DisplayId, Vec<FrameCallback>>,
216 pub(crate) frame_consumers: FxHashMap<DisplayId, Task<()>>,216 pub(crate) frame_consumers: HashMap<DisplayId, Task<()>>,
217 pub(crate) background_executor: BackgroundExecutor,217 pub(crate) background_executor: BackgroundExecutor,
218 pub(crate) foreground_executor: ForegroundExecutor,218 pub(crate) foreground_executor: ForegroundExecutor,
219 pub(crate) svg_renderer: SvgRenderer,219 pub(crate) svg_renderer: SvgRenderer,
220 asset_source: Arc<dyn AssetSource>,220 asset_source: Arc<dyn AssetSource>,
221 pub(crate) image_cache: ImageCache,221 pub(crate) image_cache: ImageCache,
222 pub(crate) text_style_stack: Vec<TextStyleRefinement>,222 pub(crate) text_style_stack: Vec<TextStyleRefinement>,
223 pub(crate) globals_by_type: FxHashMap<TypeId, Box<dyn Any>>,223 pub(crate) globals_by_type: HashMap<TypeId, Box<dyn Any>>,
224 pub(crate) entities: EntityMap,224 pub(crate) entities: EntityMap,
225 pub(crate) new_view_observers: SubscriberSet<TypeId, NewViewListener>,225 pub(crate) new_view_observers: SubscriberSet<TypeId, NewViewListener>,
226 pub(crate) windows: SlotMap<WindowId, Option<Window>>,226 pub(crate) windows: SlotMap<WindowId, Option<Window>>,
227 pub(crate) keymap: Rc<RefCell<Keymap>>,227 pub(crate) keymap: Rc<RefCell<Keymap>>,
228 pub(crate) global_action_listeners:228 pub(crate) global_action_listeners:
229 FxHashMap<TypeId, Vec<Rc<dyn Fn(&dyn Any, DispatchPhase, &mut Self)>>>,229 HashMap<TypeId, Vec<Rc<dyn Fn(&dyn Any, DispatchPhase, &mut Self)>>>,
230 pending_effects: VecDeque<Effect>,230 pending_effects: VecDeque<Effect>,
231 pub(crate) pending_notifications: FxHashSet<EntityId>,231 pub(crate) pending_notifications: HashSet<EntityId>,
232 pub(crate) pending_global_notifications: FxHashSet<TypeId>,232 pub(crate) pending_global_notifications: HashSet<TypeId>,
233 pub(crate) observers: SubscriberSet<EntityId, Handler>,233 pub(crate) observers: SubscriberSet<EntityId, Handler>,
234 // TypeId is the type of the event that the listener callback expects234 // TypeId is the type of the event that the listener callback expects
235 pub(crate) event_listeners: SubscriberSet<EntityId, (TypeId, Listener)>,235 pub(crate) event_listeners: SubscriberSet<EntityId, (TypeId, Listener)>,
@@ -274,23 +274,23 @@ impl AppContext { · 38 unmodified lines
274 flushing_effects: false,274 flushing_effects: false,
275 pending_updates: 0,275 pending_updates: 0,
276 active_drag: None,276 active_drag: None,
277 next_frame_callbacks: FxHashMap::default(),277 next_frame_callbacks: HashMap::default(),
278 frame_consumers: FxHashMap::default(),278 frame_consumers: HashMap::default(),
279 background_executor: executor,279 background_executor: executor,
280 foreground_executor,280 foreground_executor,
281 svg_renderer: SvgRenderer::new(asset_source.clone()),281 svg_renderer: SvgRenderer::new(asset_source.clone()),
282 asset_source,282 asset_source,
283 image_cache: ImageCache::new(http_client),283 image_cache: ImageCache::new(http_client),
284 text_style_stack: Vec::new(),284 text_style_stack: Vec::new(),
285 globals_by_type: FxHashMap::default(),285 globals_by_type: HashMap::default(),
286 entities,286 entities,
287 new_view_observers: SubscriberSet::new(),287 new_view_observers: SubscriberSet::new(),
288 windows: SlotMap::with_key(),288 windows: SlotMap::with_key(),
289 keymap: Rc::new(RefCell::new(Keymap::default())),289 keymap: Rc::new(RefCell::new(Keymap::default())),
290 global_action_listeners: FxHashMap::default(),290 global_action_listeners: HashMap::default(),
291 pending_effects: VecDeque::new(),291 pending_effects: VecDeque::new(),
292 pending_notifications: FxHashSet::default(),292 pending_notifications: HashSet::default(),
293 pending_global_notifications: FxHashSet::default(),293 pending_global_notifications: HashSet::default(),
294 observers: SubscriberSet::new(),294 observers: SubscriberSet::new(),
295 event_listeners: SubscriberSet::new(),295 event_listeners: SubscriberSet::new(),
296 release_listeners: SubscriberSet::new(),296 release_listeners: SubscriberSet::new(),
crates/gpui/src/key_dispatch.rs+7−7
@@ -53,7 +53,7 @@ use crate::{ · 52 unmodified lines
53 Action, ActionRegistry, DispatchPhase, ElementContext, EntityId, FocusId, KeyBinding,53 Action, ActionRegistry, DispatchPhase, ElementContext, EntityId, FocusId, KeyBinding,
54 KeyContext, Keymap, KeymatchResult, Keystroke, KeystrokeMatcher, WindowContext,54 KeyContext, Keymap, KeymatchResult, Keystroke, KeystrokeMatcher, WindowContext,
55};55};
56use collections::FxHashMap;56use collections::HashMap;
57use smallvec::{smallvec, SmallVec};57use smallvec::{smallvec, SmallVec};
58use std::{58use std::{
59 any::{Any, TypeId},59 any::{Any, TypeId},
@@ -69,9 +69,9 @@ pub(crate) struct DispatchTree { · 9 unmodified lines
69 node_stack: Vec<DispatchNodeId>,69 node_stack: Vec<DispatchNodeId>,
70 pub(crate) context_stack: Vec<KeyContext>,70 pub(crate) context_stack: Vec<KeyContext>,
71 nodes: Vec<DispatchNode>,71 nodes: Vec<DispatchNode>,
72 focusable_node_ids: FxHashMap<FocusId, DispatchNodeId>,72 focusable_node_ids: HashMap<FocusId, DispatchNodeId>,
73 view_node_ids: FxHashMap<EntityId, DispatchNodeId>,73 view_node_ids: HashMap<EntityId, DispatchNodeId>,
74 keystroke_matchers: FxHashMap<SmallVec<[KeyContext; 4]>, KeystrokeMatcher>,74 keystroke_matchers: HashMap<SmallVec<[KeyContext; 4]>, KeystrokeMatcher>,
75 keymap: Rc<RefCell<Keymap>>,75 keymap: Rc<RefCell<Keymap>>,
76 action_registry: Rc<ActionRegistry>,76 action_registry: Rc<ActionRegistry>,
77}77}
@@ -100,9 +100,9 @@ impl DispatchTree { · 22 unmodified lines
100 node_stack: Vec::new(),100 node_stack: Vec::new(),
101 context_stack: Vec::new(),101 context_stack: Vec::new(),
102 nodes: Vec::new(),102 nodes: Vec::new(),
103 focusable_node_ids: FxHashMap::default(),103 focusable_node_ids: HashMap::default(),
104 view_node_ids: FxHashMap::default(),104 view_node_ids: HashMap::default(),
105 keystroke_matchers: FxHashMap::default(),105 keystroke_matchers: HashMap::default(),
106 keymap,106 keymap,
107 action_registry,107 action_registry,
108 }108 }
crates/gpui/src/keymap.rs+2−5
@@ -7,12 +7,9 @@ pub use context::*; · 6 unmodified lines
7pub(crate) use matcher::*;7pub(crate) use matcher::*;
8 8
9use crate::{Action, Keystroke, NoAction};9use crate::{Action, Keystroke, NoAction};
10use collections::HashSet;10use collections::{HashMap, HashSet};
11use smallvec::SmallVec;11use smallvec::SmallVec;
12use std::{12use std::any::{Any, TypeId};
13 any::{Any, TypeId},
14 collections::HashMap,
15};
16 13
17/// An opaque identifier of which version of the keymap is currently active.14/// An opaque identifier of which version of the keymap is currently active.
18/// The keymap's version is changed whenever bindings are added or removed.15/// The keymap's version is changed whenever bindings are added or removed.
crates/gpui/src/platform/mac/metal_atlas.rs+2−2
@@ -3,7 +3,7 @@ use crate::{ · 2 unmodified lines
3 Point, Size,3 Point, Size,
4};4};
5use anyhow::Result;5use anyhow::Result;
6use collections::FxHashMap;6use collections::HashMap;
7use derive_more::{Deref, DerefMut};7use derive_more::{Deref, DerefMut};
8use etagere::BucketedAtlasAllocator;8use etagere::BucketedAtlasAllocator;
9use metal::Device;9use metal::Device;
@@ -53,7 +53,7 @@ struct MetalAtlasState { · 43 unmodified lines
53 monochrome_textures: Vec<MetalAtlasTexture>,53 monochrome_textures: Vec<MetalAtlasTexture>,
54 polychrome_textures: Vec<MetalAtlasTexture>,54 polychrome_textures: Vec<MetalAtlasTexture>,
55 path_textures: Vec<MetalAtlasTexture>,55 path_textures: Vec<MetalAtlasTexture>,
56 tiles_by_key: FxHashMap<AtlasKey, AtlasTile>,56 tiles_by_key: HashMap<AtlasKey, AtlasTile>,
57}57}
58 58
59impl PlatformAtlas for MetalAtlas {59impl PlatformAtlas for MetalAtlas {
crates/gpui/src/scene.rs+2−2
@@ -2,7 +2,7 @@ use crate::{ · 1 unmodified line
2 point, AtlasTextureId, AtlasTile, Bounds, ContentMask, Corners, Edges, EntityId, Hsla, Pixels,2 point, AtlasTextureId, AtlasTile, Bounds, ContentMask, Corners, Edges, EntityId, Hsla, Pixels,
3 Point, ScaledPixels, StackingOrder,3 Point, ScaledPixels, StackingOrder,
4};4};
5use collections::{BTreeMap, FxHashSet};5use collections::{BTreeMap, HashSet};
6use std::{fmt::Debug, iter::Peekable, slice};6use std::{fmt::Debug, iter::Peekable, slice};
7 7
8// Exported to metal8// Exported to metal
@@ -159,7 +159,7 @@ impl Scene { · 150 unmodified lines
159 layer_id159 layer_id
160 }160 }
161 161
162 pub fn reuse_views(&mut self, views: &FxHashSet<EntityId>, prev_scene: &mut Self) {162 pub fn reuse_views(&mut self, views: &HashSet<EntityId>, prev_scene: &mut Self) {
163 for shadow in prev_scene.shadows.drain(..) {163 for shadow in prev_scene.shadows.drain(..) {
164 if views.contains(&shadow.view_id.into()) {164 if views.contains(&shadow.view_id.into()) {
165 let order = &prev_scene.orders_by_layer[&shadow.layer_id];165 let order = &prev_scene.orders_by_layer[&shadow.layer_id];
crates/gpui/src/taffy.rs+11−11
@@ -2,7 +2,7 @@ use crate::{ · 1 unmodified line
2 AbsoluteLength, Bounds, DefiniteLength, Edges, Length, Pixels, Point, Size, Style,2 AbsoluteLength, Bounds, DefiniteLength, Edges, Length, Pixels, Point, Size, Style,
3 WindowContext,3 WindowContext,
4};4};
5use collections::{FxHashMap, FxHashSet};5use collections::{HashMap, HashSet};
6use smallvec::SmallVec;6use smallvec::SmallVec;
7use std::fmt::Debug;7use std::fmt::Debug;
8use taffy::{8use taffy::{
@@ -17,11 +17,11 @@ type NodeMeasureFn = · 8 unmodified lines
17 17
18pub struct TaffyLayoutEngine {18pub struct TaffyLayoutEngine {
19 taffy: Taffy,19 taffy: Taffy,
20 styles: FxHashMap<LayoutId, Style>,20 styles: HashMap<LayoutId, Style>,
21 children_to_parents: FxHashMap<LayoutId, LayoutId>,21 children_to_parents: HashMap<LayoutId, LayoutId>,
22 absolute_layout_bounds: FxHashMap<LayoutId, Bounds<Pixels>>,22 absolute_layout_bounds: HashMap<LayoutId, Bounds<Pixels>>,
23 computed_layouts: FxHashSet<LayoutId>,23 computed_layouts: HashSet<LayoutId>,
24 nodes_to_measure: FxHashMap<LayoutId, NodeMeasureFn>,24 nodes_to_measure: HashMap<LayoutId, NodeMeasureFn>,
25}25}
26 26
27static EXPECT_MESSAGE: &str = "we should avoid taffy layout errors by construction if possible";27static EXPECT_MESSAGE: &str = "we should avoid taffy layout errors by construction if possible";
@@ -30,11 +30,11 @@ impl TaffyLayoutEngine { · 2 unmodified lines
30 pub fn new() -> Self {30 pub fn new() -> Self {
31 TaffyLayoutEngine {31 TaffyLayoutEngine {
32 taffy: Taffy::new(),32 taffy: Taffy::new(),
33 styles: FxHashMap::default(),33 styles: HashMap::default(),
34 children_to_parents: FxHashMap::default(),34 children_to_parents: HashMap::default(),
35 absolute_layout_bounds: FxHashMap::default(),35 absolute_layout_bounds: HashMap::default(),
36 computed_layouts: FxHashSet::default(),36 computed_layouts: HashSet::default(),
37 nodes_to_measure: FxHashMap::default(),37 nodes_to_measure: HashMap::default(),
38 }38 }
39 }39 }
40 40
crates/gpui/src/text_system.rs+6−6
@@ -13,7 +13,7 @@ use crate::{ · 12 unmodified lines
13 SharedString, Size, UnderlineStyle,13 SharedString, Size, UnderlineStyle,
14};14};
15use anyhow::anyhow;15use anyhow::anyhow;
16use collections::{BTreeSet, FxHashMap, FxHashSet};16use collections::{BTreeSet, HashMap, HashSet};
17use core::fmt;17use core::fmt;
18use derive_more::Deref;18use derive_more::Deref;
19use itertools::Itertools;19use itertools::Itertools;
@@ -42,10 +42,10 @@ pub(crate) const SUBPIXEL_VARIANTS: u8 = 4; · 22 unmodified lines
42/// The GPUI text rendering sub system.42/// The GPUI text rendering sub system.
43pub struct TextSystem {43pub struct TextSystem {
44 platform_text_system: Arc<dyn PlatformTextSystem>,44 platform_text_system: Arc<dyn PlatformTextSystem>,
45 font_ids_by_font: RwLock<FxHashMap<Font, Result<FontId>>>,45 font_ids_by_font: RwLock<HashMap<Font, Result<FontId>>>,
46 font_metrics: RwLock<FxHashMap<FontId, FontMetrics>>,46 font_metrics: RwLock<HashMap<FontId, FontMetrics>>,
47 raster_bounds: RwLock<FxHashMap<RenderGlyphParams, Bounds<DevicePixels>>>,47 raster_bounds: RwLock<HashMap<RenderGlyphParams, Bounds<DevicePixels>>>,
48 wrapper_pool: Mutex<FxHashMap<FontIdWithSize, Vec<LineWrapper>>>,48 wrapper_pool: Mutex<HashMap<FontIdWithSize, Vec<LineWrapper>>>,
49 font_runs_pool: Mutex<Vec<Vec<FontRun>>>,49 font_runs_pool: Mutex<Vec<Vec<FontRun>>>,
50 fallback_font_stack: SmallVec<[Font; 2]>,50 fallback_font_stack: SmallVec<[Font; 2]>,
51}51}
@@ -447,7 +447,7 @@ impl WindowTextSystem { · 395 unmodified lines
447 Ok(lines)447 Ok(lines)
448 }448 }
449 449
450 pub(crate) fn finish_frame(&self, reused_views: &FxHashSet<EntityId>) {450 pub(crate) fn finish_frame(&self, reused_views: &HashSet<EntityId>) {
451 self.line_layout_cache.finish_frame(reused_views)451 self.line_layout_cache.finish_frame(reused_views)
452 }452 }
453 453
crates/gpui/src/text_system/line_layout.rs+6−6
@@ -1,5 +1,5 @@
1use crate::{px, EntityId, FontId, GlyphId, Pixels, PlatformTextSystem, Point, Size};1use crate::{px, EntityId, FontId, GlyphId, Pixels, PlatformTextSystem, Point, Size};
2use collections::{FxHashMap, FxHashSet};2use collections::{HashMap, HashSet};
3use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};3use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};
4use smallvec::SmallVec;4use smallvec::SmallVec;
5use std::{5use std::{
@@ -277,10 +277,10 @@ impl WrappedLineLayout { · 271 unmodified lines
277 277
278pub(crate) struct LineLayoutCache {278pub(crate) struct LineLayoutCache {
279 view_stack: Mutex<Vec<EntityId>>,279 view_stack: Mutex<Vec<EntityId>>,
280 previous_frame: Mutex<FxHashMap<CacheKey, Arc<LineLayout>>>,280 previous_frame: Mutex<HashMap<CacheKey, Arc<LineLayout>>>,
281 current_frame: RwLock<FxHashMap<CacheKey, Arc<LineLayout>>>,281 current_frame: RwLock<HashMap<CacheKey, Arc<LineLayout>>>,
282 previous_frame_wrapped: Mutex<FxHashMap<CacheKey, Arc<WrappedLineLayout>>>,282 previous_frame_wrapped: Mutex<HashMap<CacheKey, Arc<WrappedLineLayout>>>,
283 current_frame_wrapped: RwLock<FxHashMap<CacheKey, Arc<WrappedLineLayout>>>,283 current_frame_wrapped: RwLock<HashMap<CacheKey, Arc<WrappedLineLayout>>>,
284 platform_text_system: Arc<dyn PlatformTextSystem>,284 platform_text_system: Arc<dyn PlatformTextSystem>,
285}285}
286 286
@@ -296,7 +296,7 @@ impl LineLayoutCache { · 9 unmodified lines
296 }296 }
297 }297 }
298 298
299 pub fn finish_frame(&self, reused_views: &FxHashSet<EntityId>) {299 pub fn finish_frame(&self, reused_views: &HashSet<EntityId>) {
300 debug_assert_eq!(self.view_stack.lock().len(), 0);300 debug_assert_eq!(self.view_stack.lock().len(), 0);
301 301
302 let mut prev_frame = self.previous_frame.lock();302 let mut prev_frame = self.previous_frame.lock();
crates/gpui/src/window.rs+3−3
@@ -10,7 +10,7 @@ use crate::{ · 9 unmodified lines
10 WindowOptions, WindowTextSystem,10 WindowOptions, WindowTextSystem,
11};11};
12use anyhow::{anyhow, Context as _, Result};12use anyhow::{anyhow, Context as _, Result};
13use collections::FxHashSet;13use collections::HashSet;
14use derive_more::{Deref, DerefMut};14use derive_more::{Deref, DerefMut};
15use futures::{15use futures::{
16 channel::{mpsc, oneshot},16 channel::{mpsc, oneshot},
@@ -259,7 +259,7 @@ pub struct Window { · 242 unmodified lines
259 pub(crate) element_id_stack: GlobalElementId,259 pub(crate) element_id_stack: GlobalElementId,
260 pub(crate) rendered_frame: Frame,260 pub(crate) rendered_frame: Frame,
261 pub(crate) next_frame: Frame,261 pub(crate) next_frame: Frame,
262 pub(crate) dirty_views: FxHashSet<EntityId>,262 pub(crate) dirty_views: HashSet<EntityId>,
263 pub(crate) focus_handles: Arc<RwLock<SlotMap<FocusId, AtomicUsize>>>,263 pub(crate) focus_handles: Arc<RwLock<SlotMap<FocusId, AtomicUsize>>>,
264 focus_listeners: SubscriberSet<(), AnyWindowFocusListener>,264 focus_listeners: SubscriberSet<(), AnyWindowFocusListener>,
265 focus_lost_listeners: SubscriberSet<(), AnyObserver>,265 focus_lost_listeners: SubscriberSet<(), AnyObserver>,
@@ -428,7 +428,7 @@ impl Window { · 162 unmodified lines
428 element_id_stack: GlobalElementId::default(),428 element_id_stack: GlobalElementId::default(),
429 rendered_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),429 rendered_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),
430 next_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),430 next_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),
431 dirty_views: FxHashSet::default(),431 dirty_views: HashSet::default(),
432 focus_handles: Arc::new(RwLock::new(SlotMap::with_key())),432 focus_handles: Arc::new(RwLock::new(SlotMap::with_key())),
433 focus_listeners: SubscriberSet::new(),433 focus_listeners: SubscriberSet::new(),
434 focus_lost_listeners: SubscriberSet::new(),434 focus_lost_listeners: SubscriberSet::new(),
crates/gpui/src/window/element_cx.rs+11−11
@@ -21,7 +21,7 @@ use std::{ · 20 unmodified lines
21};21};
22 22
23use anyhow::Result;23use anyhow::Result;
24use collections::{FxHashMap, FxHashSet};24use collections::{HashMap, HashSet};
25use derive_more::{Deref, DerefMut};25use derive_more::{Deref, DerefMut};
26use media::core_video::CVImageBuffer;26use media::core_video::CVImageBuffer;
27use smallvec::SmallVec;27use smallvec::SmallVec;
@@ -53,8 +53,8 @@ pub(crate) struct TooltipRequest { · 25 unmodified lines
53pub(crate) struct Frame {53pub(crate) struct Frame {
54 pub(crate) focus: Option<FocusId>,54 pub(crate) focus: Option<FocusId>,
55 pub(crate) window_active: bool,55 pub(crate) window_active: bool,
56 pub(crate) element_states: FxHashMap<GlobalElementId, ElementStateBox>,56 pub(crate) element_states: HashMap<GlobalElementId, ElementStateBox>,
57 pub(crate) mouse_listeners: FxHashMap<TypeId, Vec<(StackingOrder, EntityId, AnyMouseListener)>>,57 pub(crate) mouse_listeners: HashMap<TypeId, Vec<(StackingOrder, EntityId, AnyMouseListener)>>,
58 pub(crate) dispatch_tree: DispatchTree,58 pub(crate) dispatch_tree: DispatchTree,
59 pub(crate) scene: Scene,59 pub(crate) scene: Scene,
60 pub(crate) depth_map: Vec<(StackingOrder, EntityId, Bounds<Pixels>)>,60 pub(crate) depth_map: Vec<(StackingOrder, EntityId, Bounds<Pixels>)>,
@@ -65,13 +65,13 @@ pub(crate) struct Frame { · 4 unmodified lines
65 pub(crate) element_offset_stack: Vec<Point<Pixels>>,65 pub(crate) element_offset_stack: Vec<Point<Pixels>>,
66 pub(crate) requested_input_handler: Option<RequestedInputHandler>,66 pub(crate) requested_input_handler: Option<RequestedInputHandler>,
67 pub(crate) tooltip_request: Option<TooltipRequest>,67 pub(crate) tooltip_request: Option<TooltipRequest>,
68 pub(crate) cursor_styles: FxHashMap<EntityId, CursorStyle>,68 pub(crate) cursor_styles: HashMap<EntityId, CursorStyle>,
69 pub(crate) requested_cursor_style: Option<CursorStyle>,69 pub(crate) requested_cursor_style: Option<CursorStyle>,
70 pub(crate) view_stack: Vec<EntityId>,70 pub(crate) view_stack: Vec<EntityId>,
71 pub(crate) reused_views: FxHashSet<EntityId>,71 pub(crate) reused_views: HashSet<EntityId>,
72 72
73 #[cfg(any(test, feature = "test-support"))]73 #[cfg(any(test, feature = "test-support"))]
74 pub(crate) debug_bounds: collections::FxHashMap<String, Bounds<Pixels>>,74 pub(crate) debug_bounds: collections::HashMap<String, Bounds<Pixels>>,
75}75}
76 76
77impl Frame {77impl Frame {
@@ -79,8 +79,8 @@ impl Frame { · 1 unmodified line
79 Frame {79 Frame {
80 focus: None,80 focus: None,
81 window_active: false,81 window_active: false,
82 element_states: FxHashMap::default(),82 element_states: HashMap::default(),
83 mouse_listeners: FxHashMap::default(),83 mouse_listeners: HashMap::default(),
84 dispatch_tree,84 dispatch_tree,
85 scene: Scene::default(),85 scene: Scene::default(),
86 depth_map: Vec::new(),86 depth_map: Vec::new(),
@@ -91,13 +91,13 @@ impl Frame { · 4 unmodified lines
91 element_offset_stack: Vec::new(),91 element_offset_stack: Vec::new(),
92 requested_input_handler: None,92 requested_input_handler: None,
93 tooltip_request: None,93 tooltip_request: None,
94 cursor_styles: FxHashMap::default(),94 cursor_styles: HashMap::default(),
95 requested_cursor_style: None,95 requested_cursor_style: None,
96 view_stack: Vec::new(),96 view_stack: Vec::new(),
97 reused_views: FxHashSet::default(),97 reused_views: HashSet::default(),
98 98
99 #[cfg(any(test, feature = "test-support"))]99 #[cfg(any(test, feature = "test-support"))]
100 debug_bounds: FxHashMap::default(),100 debug_bounds: HashMap::default(),
101 }101 }
102 }102 }
103 103
crates/project_panel/src/project_panel.rs+5−13
@@ -8,6 +8,7 @@ use editor::{actions::Cancel, scroll::Autoscroll, Editor}; · 7 unmodified lines
8use file_associations::FileAssociations;8use file_associations::FileAssociations;
9 9
10use anyhow::{anyhow, Result};10use anyhow::{anyhow, Result};
11use collections::{hash_map, HashMap};
11use gpui::{12use gpui::{
12 actions, div, overlay, px, uniform_list, Action, AppContext, AssetSource, AsyncWindowContext,13 actions, div, overlay, px, uniform_list, Action, AppContext, AssetSource, AsyncWindowContext,
13 ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, InteractiveElement,14 ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
@@ -22,14 +23,7 @@ use project::{ · 8 unmodified lines
22};23};
23use project_panel_settings::{ProjectPanelDockPosition, ProjectPanelSettings};24use project_panel_settings::{ProjectPanelDockPosition, ProjectPanelSettings};
24use serde::{Deserialize, Serialize};25use serde::{Deserialize, Serialize};
25use std::{26use std::{cmp::Ordering, ffi::OsStr, ops::Range, path::Path, sync::Arc};
26 cmp::Ordering,
27 collections::{hash_map, HashMap},
28 ffi::OsStr,
29 ops::Range,
30 path::Path,
31 sync::Arc,
32};
33use theme::ThemeSettings;27use theme::ThemeSettings;
34use ui::{prelude::*, v_flex, ContextMenu, Icon, KeyBinding, Label, ListItem};28use ui::{prelude::*, v_flex, ContextMenu, Icon, KeyBinding, Label, ListItem};
35use unicase::UniCase;29use unicase::UniCase;
@@ -1699,15 +1693,13 @@ impl ClipboardEntry { · 1663 unmodified lines
1699#[cfg(test)]1693#[cfg(test)]
1700mod tests {1694mod tests {
1701 use super::*;1695 use super::*;
1696 use collections::HashSet;
1702 use gpui::{TestAppContext, View, VisualTestContext, WindowHandle};1697 use gpui::{TestAppContext, View, VisualTestContext, WindowHandle};
1703 use pretty_assertions::assert_eq;1698 use pretty_assertions::assert_eq;
1704 use project::{project_settings::ProjectSettings, FakeFs};1699 use project::{project_settings::ProjectSettings, FakeFs};
1705 use serde_json::json;1700 use serde_json::json;
1706 use settings::SettingsStore;1701 use settings::SettingsStore;
1707 use std::{1702 use std::path::{Path, PathBuf};
1708 collections::HashSet,
1709 path::{Path, PathBuf},
1710 };
1711 use workspace::AppState;1703 use workspace::AppState;
1712 1704
1713 #[gpui::test]1705 #[gpui::test]
@@ -3509,7 +3501,7 @@ mod tests { · 1795 unmodified lines
3509 cx: &mut VisualTestContext,3501 cx: &mut VisualTestContext,
3510 ) -> Vec<String> {3502 ) -> Vec<String> {
3511 let mut result = Vec::new();3503 let mut result = Vec::new();
3512 let mut project_entries = HashSet::new();3504 let mut project_entries = HashSet::default();
3513 let mut has_editor = false;3505 let mut has_editor = false;
3514 3506
3515 panel.update(cx, |panel, cx| {3507 panel.update(cx, |panel, cx| {
crates/search/src/project_search.rs+2−2
@@ -25,11 +25,11 @@ use project::{ · 24 unmodified lines
25};25};
26use semantic_index::{SemanticIndex, SemanticIndexStatus};26use semantic_index::{SemanticIndex, SemanticIndexStatus};
27 27
28use collections::HashSet;
28use settings::Settings;29use settings::Settings;
29use smol::stream::StreamExt;30use smol::stream::StreamExt;
30use std::{31use std::{
31 any::{Any, TypeId},32 any::{Any, TypeId},
32 collections::HashSet,
33 mem,33 mem,
34 ops::{Not, Range},34 ops::{Not, Range},
35 path::PathBuf,35 path::PathBuf,
@@ -955,7 +955,7 @@ impl ProjectSearchView { · 919 unmodified lines
955 semantic_state: None,955 semantic_state: None,
956 semantic_permissioned: None,956 semantic_permissioned: None,
957 search_options: options,957 search_options: options,
958 panels_with_errors: HashSet::new(),958 panels_with_errors: HashSet::default(),
959 active_match_index: None,959 active_match_index: None,
960 query_editor_was_focused: false,960 query_editor_was_focused: false,
961 included_files_editor,961 included_files_editor,
crates/semantic_index/src/parsing.rs+2−2
@@ -3,6 +3,7 @@ use ai::{ · 2 unmodified lines
3 models::TruncationDirection,3 models::TruncationDirection,
4};4};
5use anyhow::{anyhow, Result};5use anyhow::{anyhow, Result};
6use collections::HashSet;
6use language::{Grammar, Language};7use language::{Grammar, Language};
7use rusqlite::{8use rusqlite::{
8 types::{FromSql, FromSqlResult, ToSqlOutput, ValueRef},9 types::{FromSql, FromSqlResult, ToSqlOutput, ValueRef},
@@ -12,7 +13,6 @@ use sha1::{Digest, Sha1}; · 3 unmodified lines
12use std::{13use std::{
13 borrow::Cow,14 borrow::Cow,
14 cmp::{self, Reverse},15 cmp::{self, Reverse},
15 collections::HashSet,
16 ops::Range,16 ops::Range,
17 path::Path,17 path::Path,
18 sync::Arc,18 sync::Arc,
@@ -267,7 +267,7 @@ impl CodeContextRetriever { · 248 unmodified lines
267 267
268 let mut spans = Vec::new();268 let mut spans = Vec::new();
269 let mut collapsed_ranges_within = Vec::new();269 let mut collapsed_ranges_within = Vec::new();
270 let mut parsed_name_ranges = HashSet::new();270 let mut parsed_name_ranges = HashSet::default();
271 for (i, context_match) in matches.iter().enumerate() {271 for (i, context_match) in matches.iter().enumerate() {
272 // Items which are collapsible but not embeddable have no item range272 // Items which are collapsible but not embeddable have no item range
273 let item_range = if let Some(item_range) = context_match.item_range.clone() {273 let item_range = if let Some(item_range) = context_match.item_range.clone() {
crates/sqlez/Cargo.toml+1−0
@@ -7,6 +7,7 @@ license = "GPL-3.0-or-later" · 6 unmodified lines
7 7
8[dependencies]8[dependencies]
9anyhow.workspace = true9anyhow.workspace = true
10collections.workspace = true
10futures.workspace = true11futures.workspace = true
11indoc.workspace = true12indoc.workspace = true
12lazy_static.workspace = true13lazy_static.workspace = true
crates/sqlez/src/thread_safe_connection.rs+2−1
@@ -1,8 +1,9 @@
1use anyhow::Context;1use anyhow::Context;
2use collections::HashMap;
2use futures::{channel::oneshot, Future, FutureExt};3use futures::{channel::oneshot, Future, FutureExt};
3use lazy_static::lazy_static;4use lazy_static::lazy_static;
4use parking_lot::{Mutex, RwLock};5use parking_lot::{Mutex, RwLock};
5use std::{collections::HashMap, marker::PhantomData, ops::Deref, sync::Arc, thread};6use std::{marker::PhantomData, ops::Deref, sync::Arc, thread};
6use thread_local::ThreadLocal;7use thread_local::ThreadLocal;
7 8
8use crate::{connection::Connection, domain::Migrator, util::UnboundedSyncSender};9use crate::{connection::Connection, domain::Migrator, util::UnboundedSyncSender};
crates/terminal/Cargo.toml+1−0
@@ -13,6 +13,7 @@ doctest = false · 12 unmodified lines
13[dependencies]13[dependencies]
14alacritty_terminal = "0.22.0"14alacritty_terminal = "0.22.0"
15anyhow.workspace = true15anyhow.workspace = true
16collections.workspace = true
16db.workspace = true17db.workspace = true
17dirs = "4.0.0"18dirs = "4.0.0"
18futures.workspace = true19futures.workspace = true
crates/terminal/src/terminal.rs+1−1
@@ -30,6 +30,7 @@ use mappings::mouse::{ · 29 unmodified lines
30 scroll_report,30 scroll_report,
31};31};
32 32
33use collections::{HashMap, VecDeque};
33use procinfo::LocalProcessInfo;34use procinfo::LocalProcessInfo;
34use serde::{Deserialize, Serialize};35use serde::{Deserialize, Serialize};
35use settings::Settings;36use settings::Settings;
@@ -39,7 +40,6 @@ use util::truncate_and_trailoff; · 3 unmodified lines
39 40
40use std::{41use std::{
41 cmp::{self, min},42 cmp::{self, min},
42 collections::{HashMap, VecDeque},
43 fmt::Display,43 fmt::Display,
44 ops::{Deref, Index, RangeInclusive},44 ops::{Deref, Index, RangeInclusive},
45 os::unix::prelude::AsRawFd,45 os::unix::prelude::AsRawFd,
crates/terminal/src/terminal_settings.rs+2−1
@@ -1,3 +1,4 @@
1use collections::HashMap;
1use gpui::{px, AbsoluteLength, AppContext, FontFeatures, Pixels};2use gpui::{px, AbsoluteLength, AppContext, FontFeatures, Pixels};
2use schemars::{3use schemars::{
3 gen::SchemaGenerator,4 gen::SchemaGenerator,
@@ -7,7 +8,7 @@ use schemars::{ · 3 unmodified lines
7use serde_derive::{Deserialize, Serialize};8use serde_derive::{Deserialize, Serialize};
8use serde_json::Value;9use serde_json::Value;
9use settings::SettingsJsonSchemaParams;10use settings::SettingsJsonSchemaParams;
10use std::{collections::HashMap, path::PathBuf};11use std::path::PathBuf;
11 12
12#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]13#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
13#[serde(rename_all = "snake_case")]14#[serde(rename_all = "snake_case")]
crates/theme/Cargo.toml+2−5
@@ -8,11 +8,7 @@ license = "GPL-3.0-or-later" · 7 unmodified lines
8[features]8[features]
9default = []9default = []
10stories = ["dep:itertools", "dep:story"]10stories = ["dep:itertools", "dep:story"]
11test-support = [11test-support = ["gpui/test-support", "fs/test-support", "settings/test-support"]
12 "gpui/test-support",
13 "fs/test-support",
14 "settings/test-support"
15]
16 12
17[lib]13[lib]
18path = "src/theme.rs"14path = "src/theme.rs"
@@ -20,6 +16,7 @@ doctest = false · 1 unmodified line
20 16
21[dependencies]17[dependencies]
22anyhow.workspace = true18anyhow.workspace = true
19collections.workspace = true
23color.workspace = true20color.workspace = true
24derive_more.workspace = true21derive_more.workspace = true
25fs.workspace = true22fs.workspace = true
crates/theme/src/registry.rs+2−2
@@ -1,8 +1,8 @@
1use std::collections::HashMap;
2use std::path::Path;1use std::path::Path;
3use std::sync::Arc;2use std::sync::Arc;
4 3
5use anyhow::{anyhow, Context, Result};4use anyhow::{anyhow, Context, Result};
5use collections::HashMap;
6use derive_more::{Deref, DerefMut};6use derive_more::{Deref, DerefMut};
7use fs::Fs;7use fs::Fs;
8use futures::StreamExt;8use futures::StreamExt;
@@ -64,7 +64,7 @@ impl ThemeRegistry { · 55 unmodified lines
64 pub fn new(assets: Box<dyn AssetSource>) -> Self {64 pub fn new(assets: Box<dyn AssetSource>) -> Self {
65 let registry = Self {65 let registry = Self {
66 state: RwLock::new(ThemeRegistryState {66 state: RwLock::new(ThemeRegistryState {
67 themes: HashMap::new(),67 themes: HashMap::default(),
68 }),68 }),
69 assets,69 assets,
70 };70 };
crates/util/Cargo.toml+1−0
@@ -15,6 +15,7 @@ test-support = ["tempfile", "git2"] · 14 unmodified lines
15[dependencies]15[dependencies]
16anyhow.workspace = true16anyhow.workspace = true
17backtrace = "0.3"17backtrace = "0.3"
18collections.workspace = true
18dirs = "3.0"19dirs = "3.0"
19futures.workspace = true20futures.workspace = true
20git2 = { workspace = true, optional = true }21git2 = { workspace = true, optional = true }
crates/util/src/test/marked_text.rs+2−1
@@ -1,4 +1,5 @@
1use std::{cmp::Ordering, collections::HashMap, ops::Range};1use collections::HashMap;
2use std::{cmp::Ordering, ops::Range};
2 3
3/// Construct a string and a list of offsets within that string using a single4/// Construct a string and a list of offsets within that string using a single
4/// string containing embedded position markers.5/// string containing embedded position markers.
crates/zed/src/open_listener.rs+2−2
@@ -1,6 +1,7 @@
1use anyhow::{anyhow, Context, Result};1use anyhow::{anyhow, Context, Result};
2use cli::{ipc, IpcHandshake};2use cli::{ipc, IpcHandshake};
3use cli::{ipc::IpcSender, CliRequest, CliResponse};3use cli::{ipc::IpcSender, CliRequest, CliResponse};
4use collections::HashMap;
4use editor::scroll::Autoscroll;5use editor::scroll::Autoscroll;
5use editor::Editor;6use editor::Editor;
6use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};7use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
@@ -10,7 +11,6 @@ use gpui::{AppContext, AsyncAppContext, Global}; · 3 unmodified lines
10use itertools::Itertools;11use itertools::Itertools;
11use language::{Bias, Point};12use language::{Bias, Point};
12use release_channel::parse_zed_link;13use release_channel::parse_zed_link;
13use std::collections::HashMap;
14use std::ffi::OsStr;14use std::ffi::OsStr;
15use std::os::unix::prelude::OsStrExt;15use std::os::unix::prelude::OsStrExt;
16use std::path::Path;16use std::path::Path;
@@ -176,7 +176,7 @@ pub async fn handle_cli_connection( · 159 unmodified lines
176 if let Some(request) = requests.next().await {176 if let Some(request) = requests.next().await {
177 match request {177 match request {
178 CliRequest::Open { paths, wait } => {178 CliRequest::Open { paths, wait } => {
179 let mut caret_positions = HashMap::new();179 let mut caret_positions = HashMap::default();
180 180
181 let paths = if paths.is_empty() {181 let paths = if paths.is_empty() {
182 workspace::last_opened_workspace_paths()182 workspace::last_opened_workspace_paths()
crates/zed/src/zed.rs+2−4
@@ -733,6 +733,7 @@ fn open_settings_file( · 732 unmodified lines
733mod tests {733mod tests {
734 use super::*;734 use super::*;
735 use assets::Assets;735 use assets::Assets;
736 use collections::HashSet;
736 use editor::{scroll::Autoscroll, DisplayPoint, Editor};737 use editor::{scroll::Autoscroll, DisplayPoint, Editor};
737 use gpui::{738 use gpui::{
738 actions, Action, AnyWindowHandle, AppContext, AssetSource, Entity, TestAppContext,739 actions, Action, AnyWindowHandle, AppContext, AssetSource, Entity, TestAppContext,
@@ -742,10 +743,7 @@ mod tests { · 3 unmodified lines
742 use project::{project_settings::ProjectSettings, Project, ProjectPath};743 use project::{project_settings::ProjectSettings, Project, ProjectPath};
743 use serde_json::json;744 use serde_json::json;
744 use settings::{handle_settings_file_changes, watch_config_file, SettingsStore};745 use settings::{handle_settings_file_changes, watch_config_file, SettingsStore};
745 use std::{746 use std::path::{Path, PathBuf};
746 collections::HashSet,
747 path::{Path, PathBuf},
748 };
749 use theme::{ThemeRegistry, ThemeSettings};747 use theme::{ThemeRegistry, ThemeSettings};
750 use workspace::{748 use workspace::{
751 item::{Item, ItemHandle},749 item::{Item, ItemHandle},