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
75307530 version = "0.1.0"
75317531 dependencies = [
75327532 "anyhow",
7533+ "collections",
75337534 "futures 0.3.28",
75347535 "indoc",
75357536 "lazy_static",
@@ -8105,6 +8106,7 @@ version = "0.1.0" · 569 unmodified lines
81058106 dependencies = [
81068107 "alacritty_terminal",
81078108 "anyhow",
8109+ "collections",
81088110 "db",
81098111 "dirs 4.0.0",
81108112 "futures 0.3.28",
@@ -8200,6 +8202,7 @@ name = "theme" · 89 unmodified lines
82008202 version = "0.1.0"
82018203 dependencies = [
82028204 "anyhow",
8205+ "collections",
82038206 "color",
82048207 "derive_more",
82058208 "fs",
@@ -9343,6 +9346,7 @@ version = "0.1.0" · 1137 unmodified lines
93439346 dependencies = [
93449347 "anyhow",
93459348 "backtrace",
9349+ "collections",
93469350 "dirs 3.0.2",
93479351 "futures 0.3.28",
93489352 "git2",
crates/channel/src/channel_chat.rs+1−1
@@ -5,13 +5,13 @@ use client::{ · 4 unmodified lines
55 user::{User, UserStore},
66 Client, Subscription, TypedEnvelope, UserId,
77 };
8+use collections::HashSet;
89 use futures::lock::Mutex;
910 use gpui::{
1011 AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Task, WeakModel,
1112 };
1213 use rand::prelude::*;
1314 use std::{
14− collections::HashSet,
1515 ops::{ControlFlow, Range},
1616 sync::Arc,
1717 };
crates/client/src/client.rs+1−1
@@ -10,6 +10,7 @@ use async_tungstenite::tungstenite::{ · 9 unmodified lines
1010 error::Error as WebsocketError,
1111 http::{Request, StatusCode},
1212 };
13+use collections::HashMap;
1314 use futures::{
1415 channel::oneshot, future::LocalBoxFuture, AsyncReadExt, FutureExt, SinkExt, StreamExt,
1516 TryFutureExt as _, TryStreamExt,
@@ -29,7 +30,6 @@ use serde_json; · 13 unmodified lines
2930 use settings::{Settings, SettingsStore};
3031 use std::{
3132 any::TypeId,
32− collections::HashMap,
3333 convert::TryFrom,
3434 fmt::Write as _,
3535 future::Future,
crates/gpui/src/app.rs+13−13
@@ -23,7 +23,7 @@ use crate::{ · 22 unmodified lines
2323 TextSystem, View, ViewContext, Window, WindowContext, WindowHandle, WindowId,
2424 };
2525 use anyhow::{anyhow, Result};
26−use collections::{FxHashMap, FxHashSet, VecDeque};
26+use collections::{HashMap, HashSet, VecDeque};
2727 use futures::{channel::oneshot, future::LocalBoxFuture, Future};
2828
2929 use slotmap::SlotMap;
@@ -212,24 +212,24 @@ pub struct AppContext { · 182 unmodified lines
212212 pending_updates: usize,
213213 pub(crate) actions: Rc<ActionRegistry>,
214214 pub(crate) active_drag: Option<AnyDrag>,
215− pub(crate) next_frame_callbacks: FxHashMap<DisplayId, Vec<FrameCallback>>,
216− pub(crate) frame_consumers: FxHashMap<DisplayId, Task<()>>,
215+ pub(crate) next_frame_callbacks: HashMap<DisplayId, Vec<FrameCallback>>,
216+ pub(crate) frame_consumers: HashMap<DisplayId, Task<()>>,
217217 pub(crate) background_executor: BackgroundExecutor,
218218 pub(crate) foreground_executor: ForegroundExecutor,
219219 pub(crate) svg_renderer: SvgRenderer,
220220 asset_source: Arc<dyn AssetSource>,
221221 pub(crate) image_cache: ImageCache,
222222 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>>,
224224 pub(crate) entities: EntityMap,
225225 pub(crate) new_view_observers: SubscriberSet<TypeId, NewViewListener>,
226226 pub(crate) windows: SlotMap<WindowId, Option<Window>>,
227227 pub(crate) keymap: Rc<RefCell<Keymap>>,
228228 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)>>>,
230230 pending_effects: VecDeque<Effect>,
231− pub(crate) pending_notifications: FxHashSet<EntityId>,
232− pub(crate) pending_global_notifications: FxHashSet<TypeId>,
231+ pub(crate) pending_notifications: HashSet<EntityId>,
232+ pub(crate) pending_global_notifications: HashSet<TypeId>,
233233 pub(crate) observers: SubscriberSet<EntityId, Handler>,
234234 // TypeId is the type of the event that the listener callback expects
235235 pub(crate) event_listeners: SubscriberSet<EntityId, (TypeId, Listener)>,
@@ -274,23 +274,23 @@ impl AppContext { · 38 unmodified lines
274274 flushing_effects: false,
275275 pending_updates: 0,
276276 active_drag: None,
277− next_frame_callbacks: FxHashMap::default(),
278− frame_consumers: FxHashMap::default(),
277+ next_frame_callbacks: HashMap::default(),
278+ frame_consumers: HashMap::default(),
279279 background_executor: executor,
280280 foreground_executor,
281281 svg_renderer: SvgRenderer::new(asset_source.clone()),
282282 asset_source,
283283 image_cache: ImageCache::new(http_client),
284284 text_style_stack: Vec::new(),
285− globals_by_type: FxHashMap::default(),
285+ globals_by_type: HashMap::default(),
286286 entities,
287287 new_view_observers: SubscriberSet::new(),
288288 windows: SlotMap::with_key(),
289289 keymap: Rc::new(RefCell::new(Keymap::default())),
290− global_action_listeners: FxHashMap::default(),
290+ global_action_listeners: HashMap::default(),
291291 pending_effects: VecDeque::new(),
292− pending_notifications: FxHashSet::default(),
293− pending_global_notifications: FxHashSet::default(),
292+ pending_notifications: HashSet::default(),
293+ pending_global_notifications: HashSet::default(),
294294 observers: SubscriberSet::new(),
295295 event_listeners: SubscriberSet::new(),
296296 release_listeners: SubscriberSet::new(),
crates/gpui/src/key_dispatch.rs+7−7
@@ -53,7 +53,7 @@ use crate::{ · 52 unmodified lines
5353 Action, ActionRegistry, DispatchPhase, ElementContext, EntityId, FocusId, KeyBinding,
5454 KeyContext, Keymap, KeymatchResult, Keystroke, KeystrokeMatcher, WindowContext,
5555 };
56−use collections::FxHashMap;
56+use collections::HashMap;
5757 use smallvec::{smallvec, SmallVec};
5858 use std::{
5959 any::{Any, TypeId},
@@ -69,9 +69,9 @@ pub(crate) struct DispatchTree { · 9 unmodified lines
6969 node_stack: Vec<DispatchNodeId>,
7070 pub(crate) context_stack: Vec<KeyContext>,
7171 nodes: Vec<DispatchNode>,
72− focusable_node_ids: FxHashMap<FocusId, DispatchNodeId>,
73− view_node_ids: FxHashMap<EntityId, DispatchNodeId>,
74− keystroke_matchers: FxHashMap<SmallVec<[KeyContext; 4]>, KeystrokeMatcher>,
72+ focusable_node_ids: HashMap<FocusId, DispatchNodeId>,
73+ view_node_ids: HashMap<EntityId, DispatchNodeId>,
74+ keystroke_matchers: HashMap<SmallVec<[KeyContext; 4]>, KeystrokeMatcher>,
7575 keymap: Rc<RefCell<Keymap>>,
7676 action_registry: Rc<ActionRegistry>,
7777 }
@@ -100,9 +100,9 @@ impl DispatchTree { · 22 unmodified lines
100100 node_stack: Vec::new(),
101101 context_stack: Vec::new(),
102102 nodes: Vec::new(),
103− focusable_node_ids: FxHashMap::default(),
104− view_node_ids: FxHashMap::default(),
105− keystroke_matchers: FxHashMap::default(),
103+ focusable_node_ids: HashMap::default(),
104+ view_node_ids: HashMap::default(),
105+ keystroke_matchers: HashMap::default(),
106106 keymap,
107107 action_registry,
108108 }
crates/gpui/src/keymap.rs+2−5
@@ -7,12 +7,9 @@ pub use context::*; · 6 unmodified lines
77 pub(crate) use matcher::*;
88
99 use crate::{Action, Keystroke, NoAction};
10−use collections::HashSet;
10+use collections::{HashMap, HashSet};
1111 use smallvec::SmallVec;
12−use std::{
13− any::{Any, TypeId},
14− collections::HashMap,
15−};
12+use std::any::{Any, TypeId};
1613
1714 /// An opaque identifier of which version of the keymap is currently active.
1815 /// 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
33 Point, Size,
44 };
55 use anyhow::Result;
6−use collections::FxHashMap;
6+use collections::HashMap;
77 use derive_more::{Deref, DerefMut};
88 use etagere::BucketedAtlasAllocator;
99 use metal::Device;
@@ -53,7 +53,7 @@ struct MetalAtlasState { · 43 unmodified lines
5353 monochrome_textures: Vec<MetalAtlasTexture>,
5454 polychrome_textures: Vec<MetalAtlasTexture>,
5555 path_textures: Vec<MetalAtlasTexture>,
56− tiles_by_key: FxHashMap<AtlasKey, AtlasTile>,
56+ tiles_by_key: HashMap<AtlasKey, AtlasTile>,
5757 }
5858
5959 impl PlatformAtlas for MetalAtlas {
crates/gpui/src/scene.rs+2−2
@@ -2,7 +2,7 @@ use crate::{ · 1 unmodified line
22 point, AtlasTextureId, AtlasTile, Bounds, ContentMask, Corners, Edges, EntityId, Hsla, Pixels,
33 Point, ScaledPixels, StackingOrder,
44 };
5−use collections::{BTreeMap, FxHashSet};
5+use collections::{BTreeMap, HashSet};
66 use std::{fmt::Debug, iter::Peekable, slice};
77
88 // Exported to metal
@@ -159,7 +159,7 @@ impl Scene { · 150 unmodified lines
159159 layer_id
160160 }
161161
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) {
163163 for shadow in prev_scene.shadows.drain(..) {
164164 if views.contains(&shadow.view_id.into()) {
165165 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
22 AbsoluteLength, Bounds, DefiniteLength, Edges, Length, Pixels, Point, Size, Style,
33 WindowContext,
44 };
5−use collections::{FxHashMap, FxHashSet};
5+use collections::{HashMap, HashSet};
66 use smallvec::SmallVec;
77 use std::fmt::Debug;
88 use taffy::{
@@ -17,11 +17,11 @@ type NodeMeasureFn = · 8 unmodified lines
1717
1818 pub struct TaffyLayoutEngine {
1919 taffy: Taffy,
20− styles: FxHashMap<LayoutId, Style>,
21− children_to_parents: FxHashMap<LayoutId, LayoutId>,
22− absolute_layout_bounds: FxHashMap<LayoutId, Bounds<Pixels>>,
23− computed_layouts: FxHashSet<LayoutId>,
24− nodes_to_measure: FxHashMap<LayoutId, NodeMeasureFn>,
20+ styles: HashMap<LayoutId, Style>,
21+ children_to_parents: HashMap<LayoutId, LayoutId>,
22+ absolute_layout_bounds: HashMap<LayoutId, Bounds<Pixels>>,
23+ computed_layouts: HashSet<LayoutId>,
24+ nodes_to_measure: HashMap<LayoutId, NodeMeasureFn>,
2525 }
2626
2727 static EXPECT_MESSAGE: &str = "we should avoid taffy layout errors by construction if possible";
@@ -30,11 +30,11 @@ impl TaffyLayoutEngine { · 2 unmodified lines
3030 pub fn new() -> Self {
3131 TaffyLayoutEngine {
3232 taffy: Taffy::new(),
33− styles: FxHashMap::default(),
34− children_to_parents: FxHashMap::default(),
35− absolute_layout_bounds: FxHashMap::default(),
36− computed_layouts: FxHashSet::default(),
37− nodes_to_measure: FxHashMap::default(),
33+ styles: HashMap::default(),
34+ children_to_parents: HashMap::default(),
35+ absolute_layout_bounds: HashMap::default(),
36+ computed_layouts: HashSet::default(),
37+ nodes_to_measure: HashMap::default(),
3838 }
3939 }
4040
crates/gpui/src/text_system.rs+6−6
@@ -13,7 +13,7 @@ use crate::{ · 12 unmodified lines
1313 SharedString, Size, UnderlineStyle,
1414 };
1515 use anyhow::anyhow;
16−use collections::{BTreeSet, FxHashMap, FxHashSet};
16+use collections::{BTreeSet, HashMap, HashSet};
1717 use core::fmt;
1818 use derive_more::Deref;
1919 use itertools::Itertools;
@@ -42,10 +42,10 @@ pub(crate) const SUBPIXEL_VARIANTS: u8 = 4; · 22 unmodified lines
4242 /// The GPUI text rendering sub system.
4343 pub struct TextSystem {
4444 platform_text_system: Arc<dyn PlatformTextSystem>,
45− font_ids_by_font: RwLock<FxHashMap<Font, Result<FontId>>>,
46− font_metrics: RwLock<FxHashMap<FontId, FontMetrics>>,
47− raster_bounds: RwLock<FxHashMap<RenderGlyphParams, Bounds<DevicePixels>>>,
48− wrapper_pool: Mutex<FxHashMap<FontIdWithSize, Vec<LineWrapper>>>,
45+ font_ids_by_font: RwLock<HashMap<Font, Result<FontId>>>,
46+ font_metrics: RwLock<HashMap<FontId, FontMetrics>>,
47+ raster_bounds: RwLock<HashMap<RenderGlyphParams, Bounds<DevicePixels>>>,
48+ wrapper_pool: Mutex<HashMap<FontIdWithSize, Vec<LineWrapper>>>,
4949 font_runs_pool: Mutex<Vec<Vec<FontRun>>>,
5050 fallback_font_stack: SmallVec<[Font; 2]>,
5151 }
@@ -447,7 +447,7 @@ impl WindowTextSystem { · 395 unmodified lines
447447 Ok(lines)
448448 }
449449
450− pub(crate) fn finish_frame(&self, reused_views: &FxHashSet<EntityId>) {
450+ pub(crate) fn finish_frame(&self, reused_views: &HashSet<EntityId>) {
451451 self.line_layout_cache.finish_frame(reused_views)
452452 }
453453
crates/gpui/src/text_system/line_layout.rs+6−6
@@ -1,5 +1,5 @@
11 use crate::{px, EntityId, FontId, GlyphId, Pixels, PlatformTextSystem, Point, Size};
2−use collections::{FxHashMap, FxHashSet};
2+use collections::{HashMap, HashSet};
33 use parking_lot::{Mutex, RwLock, RwLockUpgradableReadGuard};
44 use smallvec::SmallVec;
55 use std::{
@@ -277,10 +277,10 @@ impl WrappedLineLayout { · 271 unmodified lines
277277
278278 pub(crate) struct LineLayoutCache {
279279 view_stack: Mutex<Vec<EntityId>>,
280− previous_frame: Mutex<FxHashMap<CacheKey, Arc<LineLayout>>>,
281− current_frame: RwLock<FxHashMap<CacheKey, Arc<LineLayout>>>,
282− previous_frame_wrapped: Mutex<FxHashMap<CacheKey, Arc<WrappedLineLayout>>>,
283− current_frame_wrapped: RwLock<FxHashMap<CacheKey, Arc<WrappedLineLayout>>>,
280+ previous_frame: Mutex<HashMap<CacheKey, Arc<LineLayout>>>,
281+ current_frame: RwLock<HashMap<CacheKey, Arc<LineLayout>>>,
282+ previous_frame_wrapped: Mutex<HashMap<CacheKey, Arc<WrappedLineLayout>>>,
283+ current_frame_wrapped: RwLock<HashMap<CacheKey, Arc<WrappedLineLayout>>>,
284284 platform_text_system: Arc<dyn PlatformTextSystem>,
285285 }
286286
@@ -296,7 +296,7 @@ impl LineLayoutCache { · 9 unmodified lines
296296 }
297297 }
298298
299− pub fn finish_frame(&self, reused_views: &FxHashSet<EntityId>) {
299+ pub fn finish_frame(&self, reused_views: &HashSet<EntityId>) {
300300 debug_assert_eq!(self.view_stack.lock().len(), 0);
301301
302302 let mut prev_frame = self.previous_frame.lock();
crates/gpui/src/window.rs+3−3
@@ -10,7 +10,7 @@ use crate::{ · 9 unmodified lines
1010 WindowOptions, WindowTextSystem,
1111 };
1212 use anyhow::{anyhow, Context as _, Result};
13−use collections::FxHashSet;
13+use collections::HashSet;
1414 use derive_more::{Deref, DerefMut};
1515 use futures::{
1616 channel::{mpsc, oneshot},
@@ -259,7 +259,7 @@ pub struct Window { · 242 unmodified lines
259259 pub(crate) element_id_stack: GlobalElementId,
260260 pub(crate) rendered_frame: Frame,
261261 pub(crate) next_frame: Frame,
262− pub(crate) dirty_views: FxHashSet<EntityId>,
262+ pub(crate) dirty_views: HashSet<EntityId>,
263263 pub(crate) focus_handles: Arc<RwLock<SlotMap<FocusId, AtomicUsize>>>,
264264 focus_listeners: SubscriberSet<(), AnyWindowFocusListener>,
265265 focus_lost_listeners: SubscriberSet<(), AnyObserver>,
@@ -428,7 +428,7 @@ impl Window { · 162 unmodified lines
428428 element_id_stack: GlobalElementId::default(),
429429 rendered_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),
430430 next_frame: Frame::new(DispatchTree::new(cx.keymap.clone(), cx.actions.clone())),
431− dirty_views: FxHashSet::default(),
431+ dirty_views: HashSet::default(),
432432 focus_handles: Arc::new(RwLock::new(SlotMap::with_key())),
433433 focus_listeners: SubscriberSet::new(),
434434 focus_lost_listeners: SubscriberSet::new(),
crates/gpui/src/window/element_cx.rs+11−11
@@ -21,7 +21,7 @@ use std::{ · 20 unmodified lines
2121 };
2222
2323 use anyhow::Result;
24−use collections::{FxHashMap, FxHashSet};
24+use collections::{HashMap, HashSet};
2525 use derive_more::{Deref, DerefMut};
2626 use media::core_video::CVImageBuffer;
2727 use smallvec::SmallVec;
@@ -53,8 +53,8 @@ pub(crate) struct TooltipRequest { · 25 unmodified lines
5353 pub(crate) struct Frame {
5454 pub(crate) focus: Option<FocusId>,
5555 pub(crate) window_active: bool,
56− pub(crate) element_states: FxHashMap<GlobalElementId, ElementStateBox>,
57− pub(crate) mouse_listeners: FxHashMap<TypeId, Vec<(StackingOrder, EntityId, AnyMouseListener)>>,
56+ pub(crate) element_states: HashMap<GlobalElementId, ElementStateBox>,
57+ pub(crate) mouse_listeners: HashMap<TypeId, Vec<(StackingOrder, EntityId, AnyMouseListener)>>,
5858 pub(crate) dispatch_tree: DispatchTree,
5959 pub(crate) scene: Scene,
6060 pub(crate) depth_map: Vec<(StackingOrder, EntityId, Bounds<Pixels>)>,
@@ -65,13 +65,13 @@ pub(crate) struct Frame { · 4 unmodified lines
6565 pub(crate) element_offset_stack: Vec<Point<Pixels>>,
6666 pub(crate) requested_input_handler: Option<RequestedInputHandler>,
6767 pub(crate) tooltip_request: Option<TooltipRequest>,
68− pub(crate) cursor_styles: FxHashMap<EntityId, CursorStyle>,
68+ pub(crate) cursor_styles: HashMap<EntityId, CursorStyle>,
6969 pub(crate) requested_cursor_style: Option<CursorStyle>,
7070 pub(crate) view_stack: Vec<EntityId>,
71− pub(crate) reused_views: FxHashSet<EntityId>,
71+ pub(crate) reused_views: HashSet<EntityId>,
7272
7373 #[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>>,
7575 }
7676
7777 impl Frame {
@@ -79,8 +79,8 @@ impl Frame { · 1 unmodified line
7979 Frame {
8080 focus: None,
8181 window_active: false,
82− element_states: FxHashMap::default(),
83− mouse_listeners: FxHashMap::default(),
82+ element_states: HashMap::default(),
83+ mouse_listeners: HashMap::default(),
8484 dispatch_tree,
8585 scene: Scene::default(),
8686 depth_map: Vec::new(),
@@ -91,13 +91,13 @@ impl Frame { · 4 unmodified lines
9191 element_offset_stack: Vec::new(),
9292 requested_input_handler: None,
9393 tooltip_request: None,
94− cursor_styles: FxHashMap::default(),
94+ cursor_styles: HashMap::default(),
9595 requested_cursor_style: None,
9696 view_stack: Vec::new(),
97− reused_views: FxHashSet::default(),
97+ reused_views: HashSet::default(),
9898
9999 #[cfg(any(test, feature = "test-support"))]
100− debug_bounds: FxHashMap::default(),
100+ debug_bounds: HashMap::default(),
101101 }
102102 }
103103
crates/project_panel/src/project_panel.rs+5−13
@@ -8,6 +8,7 @@ use editor::{actions::Cancel, scroll::Autoscroll, Editor}; · 7 unmodified lines
88 use file_associations::FileAssociations;
99
1010 use anyhow::{anyhow, Result};
11+use collections::{hash_map, HashMap};
1112 use gpui::{
1213 actions, div, overlay, px, uniform_list, Action, AppContext, AssetSource, AsyncWindowContext,
1314 ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, InteractiveElement,
@@ -22,14 +23,7 @@ use project::{ · 8 unmodified lines
2223 };
2324 use project_panel_settings::{ProjectPanelDockPosition, ProjectPanelSettings};
2425 use serde::{Deserialize, Serialize};
25−use std::{
26− cmp::Ordering,
27− collections::{hash_map, HashMap},
28− ffi::OsStr,
29− ops::Range,
30− path::Path,
31− sync::Arc,
32−};
26+use std::{cmp::Ordering, ffi::OsStr, ops::Range, path::Path, sync::Arc};
3327 use theme::ThemeSettings;
3428 use ui::{prelude::*, v_flex, ContextMenu, Icon, KeyBinding, Label, ListItem};
3529 use unicase::UniCase;
@@ -1699,15 +1693,13 @@ impl ClipboardEntry { · 1663 unmodified lines
16991693 #[cfg(test)]
17001694 mod tests {
17011695 use super::*;
1696+ use collections::HashSet;
17021697 use gpui::{TestAppContext, View, VisualTestContext, WindowHandle};
17031698 use pretty_assertions::assert_eq;
17041699 use project::{project_settings::ProjectSettings, FakeFs};
17051700 use serde_json::json;
17061701 use settings::SettingsStore;
1707− use std::{
1708− collections::HashSet,
1709− path::{Path, PathBuf},
1710− };
1702+ use std::path::{Path, PathBuf};
17111703 use workspace::AppState;
17121704
17131705 #[gpui::test]
@@ -3509,7 +3501,7 @@ mod tests { · 1795 unmodified lines
35093501 cx: &mut VisualTestContext,
35103502 ) -> Vec<String> {
35113503 let mut result = Vec::new();
3512− let mut project_entries = HashSet::new();
3504+ let mut project_entries = HashSet::default();
35133505 let mut has_editor = false;
35143506
35153507 panel.update(cx, |panel, cx| {
crates/search/src/project_search.rs+2−2
@@ -25,11 +25,11 @@ use project::{ · 24 unmodified lines
2525 };
2626 use semantic_index::{SemanticIndex, SemanticIndexStatus};
2727
28+use collections::HashSet;
2829 use settings::Settings;
2930 use smol::stream::StreamExt;
3031 use std::{
3132 any::{Any, TypeId},
32− collections::HashSet,
3333 mem,
3434 ops::{Not, Range},
3535 path::PathBuf,
@@ -955,7 +955,7 @@ impl ProjectSearchView { · 919 unmodified lines
955955 semantic_state: None,
956956 semantic_permissioned: None,
957957 search_options: options,
958− panels_with_errors: HashSet::new(),
958+ panels_with_errors: HashSet::default(),
959959 active_match_index: None,
960960 query_editor_was_focused: false,
961961 included_files_editor,
crates/semantic_index/src/parsing.rs+2−2
@@ -3,6 +3,7 @@ use ai::{ · 2 unmodified lines
33 models::TruncationDirection,
44 };
55 use anyhow::{anyhow, Result};
6+use collections::HashSet;
67 use language::{Grammar, Language};
78 use rusqlite::{
89 types::{FromSql, FromSqlResult, ToSqlOutput, ValueRef},
@@ -12,7 +13,6 @@ use sha1::{Digest, Sha1}; · 3 unmodified lines
1213 use std::{
1314 borrow::Cow,
1415 cmp::{self, Reverse},
15− collections::HashSet,
1616 ops::Range,
1717 path::Path,
1818 sync::Arc,
@@ -267,7 +267,7 @@ impl CodeContextRetriever { · 248 unmodified lines
267267
268268 let mut spans = Vec::new();
269269 let mut collapsed_ranges_within = Vec::new();
270− let mut parsed_name_ranges = HashSet::new();
270+ let mut parsed_name_ranges = HashSet::default();
271271 for (i, context_match) in matches.iter().enumerate() {
272272 // Items which are collapsible but not embeddable have no item range
273273 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
77
88 [dependencies]
99 anyhow.workspace = true
10+collections.workspace = true
1011 futures.workspace = true
1112 indoc.workspace = true
1213 lazy_static.workspace = true
crates/sqlez/src/thread_safe_connection.rs+2−1
@@ -1,8 +1,9 @@
11 use anyhow::Context;
2+use collections::HashMap;
23 use futures::{channel::oneshot, Future, FutureExt};
34 use lazy_static::lazy_static;
45 use parking_lot::{Mutex, RwLock};
5−use std::{collections::HashMap, marker::PhantomData, ops::Deref, sync::Arc, thread};
6+use std::{marker::PhantomData, ops::Deref, sync::Arc, thread};
67 use thread_local::ThreadLocal;
78
89 use crate::{connection::Connection, domain::Migrator, util::UnboundedSyncSender};
crates/terminal/Cargo.toml+1−0
@@ -13,6 +13,7 @@ doctest = false · 12 unmodified lines
1313 [dependencies]
1414 alacritty_terminal = "0.22.0"
1515 anyhow.workspace = true
16+collections.workspace = true
1617 db.workspace = true
1718 dirs = "4.0.0"
1819 futures.workspace = true
crates/terminal/src/terminal.rs+1−1
@@ -30,6 +30,7 @@ use mappings::mouse::{ · 29 unmodified lines
3030 scroll_report,
3131 };
3232
33+use collections::{HashMap, VecDeque};
3334 use procinfo::LocalProcessInfo;
3435 use serde::{Deserialize, Serialize};
3536 use settings::Settings;
@@ -39,7 +40,6 @@ use util::truncate_and_trailoff; · 3 unmodified lines
3940
4041 use std::{
4142 cmp::{self, min},
42− collections::{HashMap, VecDeque},
4343 fmt::Display,
4444 ops::{Deref, Index, RangeInclusive},
4545 os::unix::prelude::AsRawFd,
crates/terminal/src/terminal_settings.rs+2−1
@@ -1,3 +1,4 @@
1+use collections::HashMap;
12 use gpui::{px, AbsoluteLength, AppContext, FontFeatures, Pixels};
23 use schemars::{
34 gen::SchemaGenerator,
@@ -7,7 +8,7 @@ use schemars::{ · 3 unmodified lines
78 use serde_derive::{Deserialize, Serialize};
89 use serde_json::Value;
910 use settings::SettingsJsonSchemaParams;
10−use std::{collections::HashMap, path::PathBuf};
11+use std::path::PathBuf;
1112
1213 #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
1314 #[serde(rename_all = "snake_case")]
crates/theme/Cargo.toml+2−5
@@ -8,11 +8,7 @@ license = "GPL-3.0-or-later" · 7 unmodified lines
88 [features]
99 default = []
1010 stories = ["dep:itertools", "dep:story"]
11−test-support = [
12− "gpui/test-support",
13− "fs/test-support",
14− "settings/test-support"
15−]
11+test-support = ["gpui/test-support", "fs/test-support", "settings/test-support"]
1612
1713 [lib]
1814 path = "src/theme.rs"
@@ -20,6 +16,7 @@ doctest = false · 1 unmodified line
2016
2117 [dependencies]
2218 anyhow.workspace = true
19+collections.workspace = true
2320 color.workspace = true
2421 derive_more.workspace = true
2522 fs.workspace = true
crates/theme/src/registry.rs+2−2
@@ -1,8 +1,8 @@
1−use std::collections::HashMap;
21 use std::path::Path;
32 use std::sync::Arc;
43
54 use anyhow::{anyhow, Context, Result};
5+use collections::HashMap;
66 use derive_more::{Deref, DerefMut};
77 use fs::Fs;
88 use futures::StreamExt;
@@ -64,7 +64,7 @@ impl ThemeRegistry { · 55 unmodified lines
6464 pub fn new(assets: Box<dyn AssetSource>) -> Self {
6565 let registry = Self {
6666 state: RwLock::new(ThemeRegistryState {
67− themes: HashMap::new(),
67+ themes: HashMap::default(),
6868 }),
6969 assets,
7070 };
crates/util/Cargo.toml+1−0
@@ -15,6 +15,7 @@ test-support = ["tempfile", "git2"] · 14 unmodified lines
1515 [dependencies]
1616 anyhow.workspace = true
1717 backtrace = "0.3"
18+collections.workspace = true
1819 dirs = "3.0"
1920 futures.workspace = true
2021 git2 = { workspace = true, optional = true }
crates/util/src/test/marked_text.rs+2−1
@@ -1,4 +1,5 @@
1−use std::{cmp::Ordering, collections::HashMap, ops::Range};
1+use collections::HashMap;
2+use std::{cmp::Ordering, ops::Range};
23
34 /// Construct a string and a list of offsets within that string using a single
45 /// string containing embedded position markers.
crates/zed/src/open_listener.rs+2−2
@@ -1,6 +1,7 @@
11 use anyhow::{anyhow, Context, Result};
22 use cli::{ipc, IpcHandshake};
33 use cli::{ipc::IpcSender, CliRequest, CliResponse};
4+use collections::HashMap;
45 use editor::scroll::Autoscroll;
56 use editor::Editor;
67 use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
@@ -10,7 +11,6 @@ use gpui::{AppContext, AsyncAppContext, Global}; · 3 unmodified lines
1011 use itertools::Itertools;
1112 use language::{Bias, Point};
1213 use release_channel::parse_zed_link;
13−use std::collections::HashMap;
1414 use std::ffi::OsStr;
1515 use std::os::unix::prelude::OsStrExt;
1616 use std::path::Path;
@@ -176,7 +176,7 @@ pub async fn handle_cli_connection( · 159 unmodified lines
176176 if let Some(request) = requests.next().await {
177177 match request {
178178 CliRequest::Open { paths, wait } => {
179− let mut caret_positions = HashMap::new();
179+ let mut caret_positions = HashMap::default();
180180
181181 let paths = if paths.is_empty() {
182182 workspace::last_opened_workspace_paths()
crates/zed/src/zed.rs+2−4
@@ -733,6 +733,7 @@ fn open_settings_file( · 732 unmodified lines
733733 mod tests {
734734 use super::*;
735735 use assets::Assets;
736+ use collections::HashSet;
736737 use editor::{scroll::Autoscroll, DisplayPoint, Editor};
737738 use gpui::{
738739 actions, Action, AnyWindowHandle, AppContext, AssetSource, Entity, TestAppContext,
@@ -742,10 +743,7 @@ mod tests { · 3 unmodified lines
742743 use project::{project_settings::ProjectSettings, Project, ProjectPath};
743744 use serde_json::json;
744745 use settings::{handle_settings_file_changes, watch_config_file, SettingsStore};
745− use std::{
746− collections::HashSet,
747− path::{Path, PathBuf},
748− };
746+ use std::path::{Path, PathBuf};
749747 use theme::{ThemeRegistry, ThemeSettings};
750748 use workspace::{
751749 item::{Item, ItemHandle},