diff --git a/Cargo.lock b/Cargo.lock index 78a47cc604..8e72a590de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7530,6 +7530,7 @@ name = "sqlez" version = "0.1.0" dependencies = [ "anyhow", + "collections", "futures 0.3.28", "indoc", "lazy_static", @@ -8105,6 +8106,7 @@ version = "0.1.0" dependencies = [ "alacritty_terminal", "anyhow", + "collections", "db", "dirs 4.0.0", "futures 0.3.28", @@ -8200,6 +8202,7 @@ name = "theme" version = "0.1.0" dependencies = [ "anyhow", + "collections", "color", "derive_more", "fs", @@ -9343,6 +9346,7 @@ version = "0.1.0" dependencies = [ "anyhow", "backtrace", + "collections", "dirs 3.0.2", "futures 0.3.28", "git2", diff --git a/crates/channel/src/channel_chat.rs b/crates/channel/src/channel_chat.rs index ad843470be..e6ed013ade 100644 --- a/crates/channel/src/channel_chat.rs +++ b/crates/channel/src/channel_chat.rs @@ -5,13 +5,13 @@ use client::{ user::{User, UserStore}, Client, Subscription, TypedEnvelope, UserId, }; +use collections::HashSet; use futures::lock::Mutex; use gpui::{ AppContext, AsyncAppContext, Context, EventEmitter, Model, ModelContext, Task, WeakModel, }; use rand::prelude::*; use std::{ - collections::HashSet, ops::{ControlFlow, Range}, sync::Arc, }; diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index ff8adc9660..e454d3ddaf 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -10,6 +10,7 @@ use async_tungstenite::tungstenite::{ error::Error as WebsocketError, http::{Request, StatusCode}, }; +use collections::HashMap; use futures::{ channel::oneshot, future::LocalBoxFuture, AsyncReadExt, FutureExt, SinkExt, StreamExt, TryFutureExt as _, TryStreamExt, @@ -29,7 +30,6 @@ use serde_json; use settings::{Settings, SettingsStore}; use std::{ any::TypeId, - collections::HashMap, convert::TryFrom, fmt::Write as _, future::Future, diff --git a/crates/gpui/src/keymap.rs b/crates/gpui/src/keymap.rs index 45e0ebbe95..e2a6bdfc4b 100644 --- a/crates/gpui/src/keymap.rs +++ b/crates/gpui/src/keymap.rs @@ -7,12 +7,9 @@ pub use context::*; pub(crate) use matcher::*; use crate::{Action, Keystroke, NoAction}; -use collections::HashSet; +use collections::{HashMap, HashSet}; use smallvec::SmallVec; -use std::{ - any::{Any, TypeId}, - collections::HashMap, -}; +use std::any::{Any, TypeId}; /// An opaque identifier of which version of the keymap is currently active. /// The keymap's version is changed whenever bindings are added or removed. diff --git a/crates/gpui/src/window/element_cx.rs b/crates/gpui/src/window/element_cx.rs index 2f05e71673..e3d95de58d 100644 --- a/crates/gpui/src/window/element_cx.rs +++ b/crates/gpui/src/window/element_cx.rs @@ -71,7 +71,7 @@ pub(crate) struct Frame { pub(crate) reused_views: FxHashSet, #[cfg(any(test, feature = "test-support"))] - pub(crate) debug_bounds: collections::FxHashMap>, + pub(crate) debug_bounds: FxHashMap>, } impl Frame { diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index b43b5d8413..3744a36c00 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -8,6 +8,7 @@ use editor::{actions::Cancel, scroll::Autoscroll, Editor}; use file_associations::FileAssociations; use anyhow::{anyhow, Result}; +use collections::{hash_map, HashMap}; use gpui::{ actions, div, overlay, px, uniform_list, Action, AppContext, AssetSource, AsyncWindowContext, ClipboardItem, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, InteractiveElement, @@ -22,14 +23,7 @@ use project::{ }; use project_panel_settings::{ProjectPanelDockPosition, ProjectPanelSettings}; use serde::{Deserialize, Serialize}; -use std::{ - cmp::Ordering, - collections::{hash_map, HashMap}, - ffi::OsStr, - ops::Range, - path::Path, - sync::Arc, -}; +use std::{cmp::Ordering, ffi::OsStr, ops::Range, path::Path, sync::Arc}; use theme::ThemeSettings; use ui::{prelude::*, v_flex, ContextMenu, Icon, KeyBinding, Label, ListItem}; use unicase::UniCase; @@ -1699,15 +1693,13 @@ impl ClipboardEntry { #[cfg(test)] mod tests { use super::*; + use collections::HashSet; use gpui::{TestAppContext, View, VisualTestContext, WindowHandle}; use pretty_assertions::assert_eq; use project::{project_settings::ProjectSettings, FakeFs}; use serde_json::json; use settings::SettingsStore; - use std::{ - collections::HashSet, - path::{Path, PathBuf}, - }; + use std::path::{Path, PathBuf}; use workspace::AppState; #[gpui::test] @@ -3509,7 +3501,7 @@ mod tests { cx: &mut VisualTestContext, ) -> Vec { let mut result = Vec::new(); - let mut project_entries = HashSet::new(); + let mut project_entries = HashSet::default(); let mut has_editor = false; panel.update(cx, |panel, cx| { diff --git a/crates/search/src/project_search.rs b/crates/search/src/project_search.rs index f79e2556a3..ad2e894527 100644 --- a/crates/search/src/project_search.rs +++ b/crates/search/src/project_search.rs @@ -25,11 +25,11 @@ use project::{ }; use semantic_index::{SemanticIndex, SemanticIndexStatus}; +use collections::HashSet; use settings::Settings; use smol::stream::StreamExt; use std::{ any::{Any, TypeId}, - collections::HashSet, mem, ops::{Not, Range}, path::PathBuf, @@ -955,7 +955,7 @@ impl ProjectSearchView { semantic_state: None, semantic_permissioned: None, search_options: options, - panels_with_errors: HashSet::new(), + panels_with_errors: HashSet::default(), active_match_index: None, query_editor_was_focused: false, included_files_editor, diff --git a/crates/semantic_index/src/parsing.rs b/crates/semantic_index/src/parsing.rs index 9f2db711ae..e6f4a37d10 100644 --- a/crates/semantic_index/src/parsing.rs +++ b/crates/semantic_index/src/parsing.rs @@ -3,6 +3,7 @@ use ai::{ models::TruncationDirection, }; use anyhow::{anyhow, Result}; +use collections::HashSet; use language::{Grammar, Language}; use rusqlite::{ types::{FromSql, FromSqlResult, ToSqlOutput, ValueRef}, @@ -12,7 +13,6 @@ use sha1::{Digest, Sha1}; use std::{ borrow::Cow, cmp::{self, Reverse}, - collections::HashSet, ops::Range, path::Path, sync::Arc, @@ -267,7 +267,7 @@ impl CodeContextRetriever { let mut spans = Vec::new(); let mut collapsed_ranges_within = Vec::new(); - let mut parsed_name_ranges = HashSet::new(); + let mut parsed_name_ranges = HashSet::default(); for (i, context_match) in matches.iter().enumerate() { // Items which are collapsible but not embeddable have no item range let item_range = if let Some(item_range) = context_match.item_range.clone() { diff --git a/crates/sqlez/Cargo.toml b/crates/sqlez/Cargo.toml index 2ee5e6cbf3..71c67af095 100644 --- a/crates/sqlez/Cargo.toml +++ b/crates/sqlez/Cargo.toml @@ -7,6 +7,7 @@ license = "GPL-3.0-or-later" [dependencies] anyhow.workspace = true +collections.workspace = true futures.workspace = true indoc.workspace = true lazy_static.workspace = true diff --git a/crates/sqlez/src/thread_safe_connection.rs b/crates/sqlez/src/thread_safe_connection.rs index 98402df108..cd4664c9ae 100644 --- a/crates/sqlez/src/thread_safe_connection.rs +++ b/crates/sqlez/src/thread_safe_connection.rs @@ -1,8 +1,9 @@ use anyhow::Context; +use collections::HashMap; use futures::{channel::oneshot, Future, FutureExt}; use lazy_static::lazy_static; use parking_lot::{Mutex, RwLock}; -use std::{collections::HashMap, marker::PhantomData, ops::Deref, sync::Arc, thread}; +use std::{marker::PhantomData, ops::Deref, sync::Arc, thread}; use thread_local::ThreadLocal; use crate::{connection::Connection, domain::Migrator, util::UnboundedSyncSender}; diff --git a/crates/terminal/Cargo.toml b/crates/terminal/Cargo.toml index 7f12fc6eb7..a52a7c6f93 100644 --- a/crates/terminal/Cargo.toml +++ b/crates/terminal/Cargo.toml @@ -13,6 +13,7 @@ doctest = false [dependencies] alacritty_terminal = "0.22.0" anyhow.workspace = true +collections.workspace = true db.workspace = true dirs = "4.0.0" futures.workspace = true diff --git a/crates/terminal/src/terminal.rs b/crates/terminal/src/terminal.rs index ad9587a326..46c7cb0c19 100644 --- a/crates/terminal/src/terminal.rs +++ b/crates/terminal/src/terminal.rs @@ -30,6 +30,7 @@ use mappings::mouse::{ scroll_report, }; +use collections::{HashMap, VecDeque}; use procinfo::LocalProcessInfo; use serde::{Deserialize, Serialize}; use settings::Settings; @@ -39,7 +40,6 @@ use util::truncate_and_trailoff; use std::{ cmp::{self, min}, - collections::{HashMap, VecDeque}, fmt::Display, ops::{Deref, Index, RangeInclusive}, os::unix::prelude::AsRawFd, diff --git a/crates/terminal/src/terminal_settings.rs b/crates/terminal/src/terminal_settings.rs index 7b3d97145c..1a072ca8bc 100644 --- a/crates/terminal/src/terminal_settings.rs +++ b/crates/terminal/src/terminal_settings.rs @@ -1,3 +1,4 @@ +use collections::HashMap; use gpui::{px, AbsoluteLength, AppContext, FontFeatures, Pixels}; use schemars::{ gen::SchemaGenerator, @@ -7,7 +8,7 @@ use schemars::{ use serde_derive::{Deserialize, Serialize}; use serde_json::Value; use settings::SettingsJsonSchemaParams; -use std::{collections::HashMap, path::PathBuf}; +use std::path::PathBuf; #[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)] #[serde(rename_all = "snake_case")] diff --git a/crates/theme/Cargo.toml b/crates/theme/Cargo.toml index 8970cfbacf..c060627ad6 100644 --- a/crates/theme/Cargo.toml +++ b/crates/theme/Cargo.toml @@ -8,11 +8,7 @@ license = "GPL-3.0-or-later" [features] default = [] stories = ["dep:itertools", "dep:story"] -test-support = [ - "gpui/test-support", - "fs/test-support", - "settings/test-support" -] +test-support = ["gpui/test-support", "fs/test-support", "settings/test-support"] [lib] path = "src/theme.rs" @@ -20,6 +16,7 @@ doctest = false [dependencies] anyhow.workspace = true +collections.workspace = true color.workspace = true derive_more.workspace = true fs.workspace = true diff --git a/crates/theme/src/registry.rs b/crates/theme/src/registry.rs index fac119ff1d..2cc4d902a2 100644 --- a/crates/theme/src/registry.rs +++ b/crates/theme/src/registry.rs @@ -1,8 +1,8 @@ -use std::collections::HashMap; use std::path::Path; use std::sync::Arc; use anyhow::{anyhow, Context, Result}; +use collections::HashMap; use derive_more::{Deref, DerefMut}; use fs::Fs; use futures::StreamExt; @@ -64,7 +64,7 @@ impl ThemeRegistry { pub fn new(assets: Box) -> Self { let registry = Self { state: RwLock::new(ThemeRegistryState { - themes: HashMap::new(), + themes: HashMap::default(), }), assets, }; diff --git a/crates/util/Cargo.toml b/crates/util/Cargo.toml index c510d6f557..fc06ebeb4a 100644 --- a/crates/util/Cargo.toml +++ b/crates/util/Cargo.toml @@ -15,6 +15,7 @@ test-support = ["tempfile", "git2"] [dependencies] anyhow.workspace = true backtrace = "0.3" +collections.workspace = true dirs = "3.0" futures.workspace = true git2 = { workspace = true, optional = true } diff --git a/crates/util/src/test/marked_text.rs b/crates/util/src/test/marked_text.rs index dadf78622d..cf85a806e4 100644 --- a/crates/util/src/test/marked_text.rs +++ b/crates/util/src/test/marked_text.rs @@ -1,4 +1,5 @@ -use std::{cmp::Ordering, collections::HashMap, ops::Range}; +use collections::HashMap; +use std::{cmp::Ordering, ops::Range}; /// Construct a string and a list of offsets within that string using a single /// string containing embedded position markers. diff --git a/crates/zed/src/open_listener.rs b/crates/zed/src/open_listener.rs index 012b5a2413..d3ccf753d1 100644 --- a/crates/zed/src/open_listener.rs +++ b/crates/zed/src/open_listener.rs @@ -1,6 +1,7 @@ use anyhow::{anyhow, Context, Result}; use cli::{ipc, IpcHandshake}; use cli::{ipc::IpcSender, CliRequest, CliResponse}; +use collections::HashMap; use editor::scroll::Autoscroll; use editor::Editor; use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender}; @@ -10,7 +11,6 @@ use gpui::{AppContext, AsyncAppContext, Global}; use itertools::Itertools; use language::{Bias, Point}; use release_channel::parse_zed_link; -use std::collections::HashMap; use std::ffi::OsStr; use std::os::unix::prelude::OsStrExt; use std::path::Path; @@ -176,7 +176,7 @@ pub async fn handle_cli_connection( if let Some(request) = requests.next().await { match request { CliRequest::Open { paths, wait } => { - let mut caret_positions = HashMap::new(); + let mut caret_positions = HashMap::default(); let paths = if paths.is_empty() { workspace::last_opened_workspace_paths() diff --git a/crates/zed/src/zed.rs b/crates/zed/src/zed.rs index 443adac50d..b4ec471113 100644 --- a/crates/zed/src/zed.rs +++ b/crates/zed/src/zed.rs @@ -733,6 +733,7 @@ fn open_settings_file( mod tests { use super::*; use assets::Assets; + use collections::HashSet; use editor::{scroll::Autoscroll, DisplayPoint, Editor}; use gpui::{ actions, Action, AnyWindowHandle, AppContext, AssetSource, Entity, TestAppContext, @@ -742,10 +743,7 @@ mod tests { use project::{project_settings::ProjectSettings, Project, ProjectPath}; use serde_json::json; use settings::{handle_settings_file_changes, watch_config_file, SettingsStore}; - use std::{ - collections::HashSet, - path::{Path, PathBuf}, - }; + use std::path::{Path, PathBuf}; use theme::{ThemeRegistry, ThemeSettings}; use workspace::{ item::{Item, ItemHandle},